19
Quote:
Danielw42 wrote:
Trabis, one more thing. How to add display name, user location...to this block? What about displaying extra fields created in user profile module?
Just need to add an extra line:
<{php}>
global $xoopsUser;
$uid = isset($_GET['uid']) ? intval($_GET['uid']) : -1;
$mHandler = xoops_getHandler('member');
$user = $mHandler->getUser($uid);
if (!is_object($user) && is_object($xoopsUser)) {
$user =& $xoopsUser;
}
if (is_object($user)) {
$GLOBALS['xoopsTpl']->assign('user', $user->getValues());
$uavatar = $user->getVar('user_avatar');
if (file_exists(XOOPS_ROOT_PATH.'/uploads/'.$uavatar) && $uavatar != 'blank.gif') {
$GLOBALS['xoopsTpl']->assign('uavatar', XOOPS_URL.'/uploads/'.$uavatar);
}else{
$GLOBALS['xoopsTpl']->assign('uavatar', XOOPS_URL.'/uploads/noavatar.jpg');
}
}
<{/php}>
Then you can get any user data from the $user array
<{$user.uname}>
<{$user.email}>
Hum, from profile it needs to be done in other way, there should be a thread about it somewhere.