2016-08-09 41 views
0

我使用功能onUserAfterSave$isnew,但我無法獲得在Joomla 3.X中註冊的用戶的電話和地址。我只能得到姓名,用戶名,電子郵件,但沒有配置文件中的數據。Joomla 3得到個人資料

回答

0

要訪問你需要使用JUserHelper類

jimport('joomla.user.helper'); 
$user = JFactory::getUser(); 
$userProfile = JUserHelper::getProfile($user->id); //Get userprofile data 
//You can get all the user input of profile data. If you want to get country of user use 
echo "Country :" . $userProfile->profile['country']; 
0

阿米特·雷的用戶配置文件數據,

我在我的插件使用方法:

公共職能onUserAfterSave($用戶,$是否新款, $成功,$味精) { // die(print_r($ user)); 如果(是否新款$){ .............

 $pluginParams = new JRegistry($plugin->params); 

     $name   = $user['name']; 
     $name_usuario = $user['username']; 
     $email_user  = $user['email']; 
     $id_usuario  = $user['id']; 

jimport( 'joomla.user.helper');

$ user = JFactory :: getUser();

$ userProfile = JUserHelper :: getProfile($ id_usuario);

//你可以得到所有用戶輸入的配置文件數據。如果你想得到用戶使用的國家

$ user_phone = $ userProfile-> profile ['phone'];

$ user_address = $ userProfile-> profile ['address1'];

但$ user_phone和$ user_address沒有數據...什麼是錯誤?謝謝

相關問題