bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

No $user_id on profile page?

(3 posts)
  • Started 3 months ago by Thion
  • Latest reply from Thion
  • This topic is resolved

Tags:

  1. 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?

    Posted 3 months ago #
  2. 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)

    Posted 3 months ago #
  3. 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)...

    Posted 3 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.