Top Left Text cha

Web & App Development

Simple code to get the user that's visiting a profile and also to get the user that owns the profile that you're viewing...

Getting Displayed User's Profile ID

global $_CB_framework;
$displayedUser = CBuser::getUserDataInstance( $_CB_framework->displayedUser() );
$displayedUserId = $displayedUser->get( 'id' );

Getting Viewing User's Profile ID

global $_CB_framework;
$viewingUser = CBuser::getMyUserDataInstance();
$viewingUserId = $viewingUser->get( 'id' );


By the way, there's no need to use 'global $_CB_framework;' twice if you're getting both the displayed and viewing user IDs.  You only need it once per instance.


 

Add comment


Security code
Refresh

  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X