Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Function to check if group has notifications

@danbp

Participant

Thxs @shanebp, i ignored that. 🙄

Corrected function here:

function bpfr_sidebar_notifications_menu() {
global $bp;

    // if user is not logged, we do nothing
	if ( !is_user_logged_in() )
	return false;

	// if user is group member, show him notification + count	
if ( groups_is_user_member( bp_loggedin_user_id(), $bp->groups->current_group->id ) && $notifications = bp_notifications_get_notifications_for_user( $user_id, $format = 'string' ) ) { 

		$counter = 0;
			for ( $i = 0; $i < count($notifications); $i++ ) {
			$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 

			echo '<p ="'.$alt.'"><i class="fa fa-group"></i>'. $notifications[$i] .'</p>';

			$counter++;
			}	
	}
}

Shows anything group related to the concerned group member.
Mentions, membership request/reject, promotion,…

Skip to toolbar