| Re: display user avatar in template |
| by gregorybr on 2011/2/6 3:32:02 Hello I am trying to create a custom block. I want this block to include viewpmsg.php link when I am on my own profile. When I visit someone's else profile, I want to have Send the message button instead of this link. I tried to add this code, but it didn't help. le="color: #000000"><?php <{if $user_ownpage && $xoops_isuser == true}> <a href="<{xoAppUrl viewpmsg.php}>">View your messages</a> <{else}> <input type="button" onclick="javascript:openWithSelfMain('<{$xoops_url}>/pmlite.php?send2=1&to_userid=<{$user_uid}>', 'pmlite', 450, 380);" /> <{/if}>
|
| Re: display user avatar in template |
| by Danielw42 on 2010/8/6 3:18:12 You are always correct. Thanks again trabis. |
| Re: display user avatar in template |
| by trabis on 2010/8/5 22:48:18 Quote:
Just need to add an extra line: le="color: #000000"><?php <{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 le="color: #000000"><?php <{$user.uname}> <{$user.email}> Hum, from profile it needs to be done in other way, there should be a thread about it somewhere. |
| Re: display user avatar in template |
| by ghia on 2010/8/5 21:43:09 Disable caching for the block. |
| Re: display user avatar in template |
| by Danielw42 on 2010/8/5 21:38:03 Thanks for your reply noo-b. I know how to do this. I am asking how to display display name, user from.... in a block ( not in a template). If I insert $xoopsUser->getVar('uname'); , my name is both displayed on my profile and someone else's profile. |