Support » Plugin: Registrations for the Events Calendar - Event Registration Plugin » Only category of event for registration

  • Resolved BestRanger

    (@bestranger)


    Hello, is it possible to enable registration for only selected category? This means that it does not display the registration option for each of The Events categories.

    It is also possible to turn off registration information for closed events (except CSS display: none)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author roundupwp

    (@roundupwp)

    Hey BestRanger,

    This is possible though it will require a PHP snippet. You could add the following to your theme’s functions.php file (you will want to be careful with this as it can cause an error for your site).

    In this example I found the “slug” for the category and used it in the first line of code inside the function. Notice how the “one” part in the code matches the slug in this screenshot: https://snipboard.io/YqdRVo.jpg

    Code:

    function ru_registration_category( $event_meta ) {
        $category_slug = 'one'; // this should match the category slug
        
    	if ( is_admin() ) {
    		return $event_meta;
    	}
    
        $tax = 'tribe_events_cat';
        $terms = get_the_terms( $event_meta['post_id'], $tax );
        if ( empty( $terms ) ) {
            return $event_meta;
        }
    
        $ids = array();
        $slugs = array();
        foreach( $terms as $term ) {
            $ids[] = $term->term_id;
            $slugs[] = $term->slug;
        }
    
        if ( ! in_array( $category_slug, $slugs, true ) ) {
            $event_meta['registrations_disabled'] = true;
        }
    
    	return $event_meta;
    }
    add_filter( 'rtec_event_meta', 'ru_registration_category' );

    For this question:
    It is also possible to turn off registration information for closed events (except CSS display: none)

    Can you explain this a bit more? Do you mean if an event has filled you want to remove all messages relating to registration?

    – Craig

    Thread Starter BestRanger

    (@bestranger)

    Hi, thank you very much.

    – I want to display on one category registration. So on the second is showing, registration is closed, because event was already. So I fixed it by. But it works for now.

    .tribe_events_cat-CATEGORYNAME .rtec-outer-wrap.rtec-js-placement {
    display: none;
    }

    So this is fixed too by CSS. It works. It is fine. Thanks.

    Plugin Author roundupwp

    (@roundupwp)

    Ahh OK sounds good! Let me know if you need anything else.

    – Craig

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Only category of event for registration’ is closed to new replies.