Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_get_member_user_id() returns false


  • yousan
    Participant

    @hogetan

    Hello.
    I am trying to get a certain user’s xprofile field data.
    I found a topic.
    https://buddypress.org/support/topic/display-a-value-of-a-particular-custom-profile-field/

    So I tried

    global $current_user;
    $user_id = bp_get_member_user_id();
    var_dump($user_id); // <--- false!
    $class = xprofile_get_field_data('weight', $user_id );

    bp_get_member_user_id() returns false.

    At bp-members-template.php Line 708,

    	function bp_get_member_user_id() {
    		global $members_template;
    		$member_id = isset( $members_template->member->id ) ? (int) $members_template->member->id : false;

    it uses $members_template global variable.
    I dumped it, but it was NULL.

    Should I initialize or call any function before calling bp_get_member_user_id() ?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘bp_get_member_user_id() returns false’ is closed to new replies.
Skip to toolbar