catrancher

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Hide Events from Non-Members #43581
    catrancher
    Participant

    Thanks Barry. Ok. Let me see what I can work out with the tribe_get_events filter.

    Tom G.

    in reply to: Hide Events from Non-Members #43554
    catrancher
    Participant

    Any update Barry?

    Thanks,
    Tom G.

    in reply to: Hide Events from Non-Members #43065
    catrancher
    Participant

    Sure Barry. Thanks. Here’s the filter I’m using. Hope it’s OK like this:
    function tg_pre_get_posts_query( $query ) {
    if (current_user_can( ‘view_hoa_content’ ) ) {
    return;
    } elseif ( $query->is_main_query() && !is_admin() ) {
    $meta_query = array(
    ‘relation’ => ‘OR’,
    array(
    ‘key’ => ‘_members_access_role’,
    ‘value’ => ”,
    ‘compare’ => ‘NOT EXISTS’
    ),
    array(
    ‘key’ => ‘_members_access_role’,
    ‘value’ => ‘homeowner’,
    ‘compare’ => ‘!=’
    )
    );
    $query->set( ‘meta_query’, $meta_query );
    }
    return;
    }

    add_action( ‘pre_get_posts’, ‘tg_pre_get_posts_query’ );

    Let me know if you need more information! And thanks,

    Tom G.

Viewing 3 posts - 1 through 3 (of 3 total)