Title: [CODE FIX] Buddypress Attending Tab: conditional loading
Last modified: January 8, 2020

---

# [CODE FIX] Buddypress Attending Tab: conditional loading

 *  [Raruto](https://wordpress.org/support/users/raruto/)
 * (@raruto)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/code-fix-buddypress-attending-tab-conditional-loading/)
 * Hi [@netweblogic](https://wordpress.org/support/users/netweblogic/),
    I’ll report
   another bug in the following file:
 * **[events-manager/buddypress/bp-em-core.php#L101](https://plugins.trac.wordpress.org/browser/events-manager/trunk/buddypress/bp-em-core.php?rev=2224264#L101)**
 * **Bug Description:**
    Attending tab must be activated only if the booking reservations
   are enabled. (currently it is always displayed, even if rsvp is disabled)
 * **How to fix it:**
 *     ```
       if( get_option('dbem_rsvp_enabled') ) { // Additional check condition
   
       	$sub_nav[] = array(
       		'name' => __( 'Events I\'m Attending', 'events-manager'),
       		'slug' => em_bp_get_slug( 'attending' ),
       		'parent_slug' => em_bp_get_slug(),
       		'parent_url' => $em_link,
       		'screen_function' => 'bp_em_attending',
       		'position' => 20,
       		'user_has_access' => bp_is_my_profile() // Only the logged in user can access this on his/her profile
       	);
   
       }
       ```
   
 * _Regards,
    Raruto

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Raruto](https://wordpress.org/support/users/raruto/)
 * (@raruto)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/code-fix-buddypress-attending-tab-conditional-loading/#post-12305192)
 * For the same reason I report here a similar error in the following template file:
 * **[events-manager/templates/buddypress/profile.php#L31](https://plugins.trac.wordpress.org/browser/events-manager/trunk/templates/buddypress/profile.php?rev=2224264#L31)**
 * **Bug Description:**
    Attending information must be visible on profile page only
   if the booking reservations are enabled. (currently they are always displayed,
   even if rsvp is disabled)
 * **How to fix it:**
 *     ```
       <?php if( get_option('dbem_rsvp_enabled') ) : ?><!-- Additional check condition -->
       	<h4><?php _e("Events I'm Attending", 'events-manager'); ?></h4>
       	<?php
       	$EM_Person = new EM_Person( $bp->displayed_user->id );
       	$EM_Bookings = $EM_Person->get_bookings( false, apply_filters('em_bp_attending_status',1) );
       	if(count($EM_Bookings->bookings) > 0){
       		//Get events here in one query to speed things up
       		$event_ids = array();
       		foreach($EM_Bookings as $EM_Booking){
       			$event_ids[] = $EM_Booking->event_id;
       		}
       		echo EM_Events::output(array('event'=>$event_ids));
       	}else{
       		?>
       		<p><?php _e('Not attending any events yet.','events-manager'); ?></p>
       		<?php
       	}?>
       <?php endif; ?>
       ```
   
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/code-fix-buddypress-attending-tab-conditional-loading/#post-12321909)
 * Hi, I’ve let the Devs know about this.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[CODE FIX] Buddypress Attending Tab: conditional loading’ is closed to
new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/code-fix-buddypress-attending-tab-conditional-loading/#post-12321909)
 * Status: not a support question