hide community visibility to group

Home Forums Calendar Products Community Events hide community visibility to group

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1204776
    Aaron
    Participant

    I have the Pro and Community Events plugin and I’d really like to be able to hide events for users not in that group.

    For example, say I have 2 groups (buddy press) A and B

    I also have two event categories, Events A and Events B.

    Is it possible to only show the A events to group A, and only show B events to group B?

    Thank you for any suggestions!

    #1205017
    Nico
    Member

    Hi there Aaron,

    Thanks for getting in touch with us! I can help you on this 🙂

    For this you can use a snippet like this one, Exclude Category. You would need to add a conditional to test if the user is in group A or B and modify the query accordingly!

    Please let me know if the above helps or you still need further assistance,
    Best,
    Nico

    #1205735
    Aaron
    Participant

    Hi Nico.

    That seems to work for the main monthly calendar, but is there any way to do the same for the widgets too?

    Currently, with the code you supplied, I can hide an event category, but it still shows up in odd places, like the list widget, and the next event.

    Ideally it’d be sitewide, so hiding ALL category A elements throughout the site.

    Thanks for all your help.

    #1206738
    Nico
    Member

    Thanks for following up Aaron!

    Sure, the conditional in the sample provided was only working form month view. Try this modified version (and add your own logic):

    add_action( 'pre_get_posts', 'exclude_events_category' );
    function exclude_events_category( $query ) {

    // add you own conditions to the check
    if ( tribe_is_event_query() && !is_admin() ) {

    $query->set( 'tax_query', array(
    array(
    'taxonomy' => TribeEvents::TAXONOMY,
    'field' => 'slug',
    'terms' => array('results'),
    'operator' => 'NOT IN'
    )
    )
    );
    }

    return $query;
    }

    The code above should affect all front-end queries for the calendar. If you want this to affect the back-end just remove the !is_admin() condition.

    One thing I’m not sure about is ‘the next event’ you mention. You mean the next event upcoming event link in the single event view?

    Please let me know about it,
    Best,
    Nico

    #1214374
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘hide community visibility to group’ is closed to new replies.