[buddypress-trac] [BuddyPress Trac] #7658: Use WP functions to retrieve current user ID.

buddypress-trac noreply at wordpress.org
Wed Jan 17 21:43:29 UTC 2018


#7658: Use WP functions to retrieve current user ID.
--------------------------+------------------------------
 Reporter:  dcavins       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Core          |     Version:  2.9.2
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by dcavins):

 At the end of the run, we don't really end up with a WP_User object. We
 grab the user data in raw form and store it as `userdata`:


 {{{
 $bp->displayed_user->userdata = WP_User::get_data_by( 'id', $user_id );
 $bp->loggedin_user->userdata = WP_User::get_data_by( 'id', $user_id );
 }}}


 Then add some other some data, like:

 {{{
 $bp->loggedin_user->fullname       =
 $bp->loggedin_user->userdata->display_name;
 $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin =
 is_super_admin( bp_loggedin_user_id() );
 $bp->loggedin_user->domain         = bp_core_get_user_domain(
 bp_loggedin_user_id() );

 }}}

 It's kind of interesting.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7658#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list