Get values from user fields anywhere

Let's say that you are currently developing a module, or editing a existing one, or maybe writing some code from your cck custom template. And you need to get the value(s) of one or some user field(s). (without any ::fieldname:: ).
You can call the code below everywhere!
$user =& JFactory::getUser(); 
if ( $user->id ) { 
   $profileId = CCK_DB_Result( 'SELECT contentid FROM #__jseblod_cck_users WHERE userid='.$user->id ); 
   $profile = CCK_GET_Value( $profileId, array( 'phone', 'city', 'nationality' ) ); 
   $user->bind( $profile ); 
}
Then you called your field by:
echo $user->city; 
echo $user->phone; 
echo $user->nationality;
SEBLOD - Bes
November 03, 2011
604

About Author

SEBLOD - Bes