Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: bp_loggedin_user_id() is always 0

@shanebp

Moderator

In addition to Henry’s comments…

Don’t include the bp global when you don’t use it in the function.

There is no advantage to your approach, and you expose yourself to a possible timing issues re the hooks. Just call the hook:

function custom_bp_subnav() { 

        $loggedin =  bp_loggedin_user_id();
	$displayed =  bp_displayed_user_id();

	
	if ( $loggedin == $displayed) {		
		
		//  do something
	}
	
}
add_action( 'bp_setup_nav', 'custom_bp_subnav', 50 );
Skip to toolbar