Skip to:
Content
Pages
Categories
Search
Top
Bottom

No $user_id on profile page?

  • Hello

    I have encounter another problem when coding new plugin. I have a function that will return data from usermeta table:

    function get_twitter($user_id) {

    $user = bb_get_user( $user_id );

    $bb_twitter = $user->social_twitter;

    if ( $bb_twitter ) { return $bb_twitter; } else { return ""; }

    }

    It’s working fine with echo on profile edit page within other function with $user_id set as global:

    function add_socialize_to_profile_edit() {

    global $user_id, $bb_current_user, $bb_socialize;

    $bb_twitter = get_twitter($user_id);
    echo $bb_twitter;

    }

    But the same function is not working on standard profile page – therefore I can edit twitter account, but I can’t display it on profile page. Any ideas what to do in order to display it? How to get this $user_id on profile page?

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

  • _ck_
    Participant

    @_ck_

    The user_id of the user on the profile page might be in $user->ID

    try global $user; $user_id=$user->ID;

    ($user is only available on the profile page)

    I’ve already found the problem – I guess I’ve lost myself when trying to develop a plugin for both 0.9.0.2 and 1.0 ;). It’s working now and will be released today (I hope)…

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar