Support » Plugin: Registrations for the Events Calendar - Event Registration Plugin » Different color/Style when max registrations

  • Resolved vinchoz

    (@vinchoz)


    Hi,

    Is it possible to add a css class or a different style for events when there is no more ticket available… when the maximum registrations is reached?

    For month view and list view…

    Thanks for the answer

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

    (@roundupwp)

    Hey vinchoz,

    You would need some custom PHP for this currently. I was able to create some though. You would put the following in your theme’s functions.php file to get it to work. Be careful as an error can crash your site:

    function ru_custom_attendance_class() {
    	if ( ! function_exists( 'RTEC' ) ) {
    		return;
    	}
    	$event_meta = rtec_get_event_meta( get_the_ID() );
    	if ( $event_meta['registrations_left'] === 0 ) {
    		echo '<div class="ru-full">';
    	} else {
    		echo '<div class="ru-open">';
    	}
    }
    add_action( 'tribe_template_before_include:events/v2/list/event', 'ru_custom_attendance_class' );
    add_action( 'tribe_template_before_include:events/v2/month/calendar-body/day/calendar-events/calendar-event', 'ru_custom_attendance_class' );
    add_action( 'tribe_template_before_include:events/v2/month/mobile-events/mobile-day/mobile-event', 'ru_custom_attendance_class' );
    
    function ru_custom_attendance_class_after() {
    	if ( ! function_exists( 'RTEC' ) ) {
    		return;
    	}
    
    	echo '</div>';
    }
    add_action( 'tribe_template_after_include:events/v2/list/event', 'ru_custom_attendance_class_after' );
    add_action( 'tribe_template_after_include:events/v2/month/calendar-body/day/calendar-events/calendar-event', 'ru_custom_attendance_class_after' );
    add_action( 'tribe_template_after_include:events/v2/month/mobile-events/mobile-day/mobile-event', 'ru_custom_attendance_class_after' );
    

    This will add a wrapping “div” element with the class “ru-open” or “ru-full” if the registration limit is reached.

    Let me know if you have more questions!

    – Craig

    Thread Starter vinchoz

    (@vinchoz)

    Hi Craig.
    Your solution works prefectly… THANK’s

    We bought the PRO Version… to have the possibility to mark booking as PENDING before to manually confirm the booking.
    Do you imagine my question: a third class for pending booking!

    $event_meta = rtec_get_event_meta( get_the_ID() );
    	if ( $event_meta['registrations_left'] === 0 ) {
    		echo '<div class="ru-full">';
    	} elseif ( THERE IS PENDING BOOOKING  ) {
    		echo '<div class="ru-pending">';
    	} else {
    		echo '<div class="ru-open">';
    	}
    

    Have you an idea?
    Again thank you for your help and for your plugin
    Best
    Vince

    Plugin Author roundupwp

    (@roundupwp)

    Hey Vince,

    It looks like you submitted a ticket for this. Thank you! I’ll close this for now and respond to you through the ticketing system.

    – Craig

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different color/Style when max registrations’ is closed to new replies.