Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: bp_loggedin_user_id() is always 0

@shanebp

Moderator

What hook are you using?

Try:

function anika_test() { 
    echo 'logged in ID: ' .  bp_loggedin_user_id();
    echo '<br>some field: ' .  xprofile_get_field_data('some field name', bp_loggedin_user_id() );
}
add_action( 'bp_ready', 'anika_test' );

bp_displayed_user_id() needs to be called in the context of a profile.
Look at the template files for an appropriate hook.

Skip to toolbar