Show / Hide buttons not attending in events + based on current user status

1. Currently I have disabled the "Maybe" and "not attending" buttons on the event page by css.
Is it possible to switch the appearance of the buttons based on the current status, e.g. if the user is on the rsvp the button "attend" will disappear and instead "not attending" will appear?
2. I have trainings of the same type/category on different dates or different cities. Is it possible to hide the "attend" button when the user is already on the rsvp of one event in this category and show the "attend" button as soon he has cancelled the attendance.

Many thanks in advance.

  • Bojan Radonic
    • Head of Support

    Hey there @Joergen, hope you're well today :slight_smile:

    1. This should be possible by using only CSS since those buttons are getting current and ncurrent classes for user when is attending or not attending. We can use those classes and add display none to the current one so only the not current ones are being displayed.

    Leave only maybe hidden and try adding the following CSS code in the style.css file of your child theme or if your theme doesn't have custom CSS tab add it in your site using the following plugin:

    .wpmudevevents-header div.wpmudevevents-buttons .ncurrent {
        opacity: 1;
    div.wpmudevevents-buttons .current {
        display: none;

    This will remove transparency from the not current ones and hide the selected options, see video how it should work

    2. This one should be more difficult to achieve and it will most likely had to include use of PHP as well. Let me include one of our SLS developers for his valuable opinion on this issue. Please note that, developer response might be slower than usual staff response, so we appreciate your patience on this.

    Best regards,

  • Ash
    • WordPress Hacker

    Hi there

    You can try the following code:

    add_action( 'wp_head', 'check_user_rsvp' );
    function check_user_rsvp() {
    	global $post, $wpdb;
    	if( get_post_type( $post ) == 'incsub_event' ){
    		$current_user = get_current_user_id();
    		$terms = wp_get_post_terms( $post->ID, 'eab_events_category' );
    		$term_id = $terms[0]->term_id;
    		$args = array(
    		'post_type' => 'incsub_event',
    		'tax_query' => array(
    		    'taxonomy' => 'eab_events_category',
    		    'field' => 'id',
    		    'terms' => $term_id
    		$query = new WP_Query( $args );
    		$break = false;
    		foreach( $query->posts as $event ) {
    			if( $event->ID == $post->ID ) continue;
    			$event = ($event instanceof Eab_EventModel) ? $event : new Eab_EventModel($event);
    			$all_events = array($event);
    			if ($event->is_recurring()) $all_events = Eab_CollectionFactory::get_all_recurring_children_events($event);
    			$all_event_ids = array();
    			foreach ($all_events as $e) { $all_event_ids[] = $e->get_id(); }
    			$all_event_ids = array_filter(array_map('intval', $all_event_ids));
    			$status = 'yes';
    			$bookings = $wpdb->get_results($wpdb->prepare("SELECT id,user_id,event_id FROM ".Eab_EventsHub::tablename(Eab_EventsHub::BOOKING_TABLE)." WHERE event_id IN(" . join(',', $all_event_ids) . ") AND status = %s ORDER BY timestamp;", $status));
    			foreach ($bookings as $booking) {
    				if( $current_user == $booking->user_id ) {
    				.wpmudevevents-yes-submit {display: none !important}
    				$break = true;
    			if( $break ) break;

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.


  • Joergen
    • Design Lord, Child of Thor

    Hi Ash,
    Many thanks for the code. It works great, if you use the recurring events feature. Is it possible to change the code in a way, that you can e.g. select / insert an event catgory id in the script and the buttons will disappear from all other events with the same event category?
    As I have events of the same type at e.g. the same day, and/or at different locations I am not using the recurring events feature.

    Many thanks in advance.

  • Ash
    • WordPress Hacker

    Hello @Joergen

    Is it possible to change the code in a way, that you can e.g. select / insert an event catgory id in the script and the buttons will disappear from all other events with the same event category?

    Do you mean you want to set a category ID manually and the buttons should be hidden for all events of that category?


  • Joergen
    • Design Lord, Child of Thor

    Hello Ash,

    I want to achieve, that a user can only register once for a specific event category. So it's practically the same event either on a different location or at a different date - but all these events have the same event category - added when creating the event.

    Many thanks for your help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.