3
John. i was reading your code and i dont understand some of the things you are coding.
can i suggest this code? (based on your code)
function xoops_getLinkedUnameFromId( $userid = 0, $usereal = 0, $is_linked = 1 ) {
$userid = intval( $userid ) > 0 ? intval( $userid ) : 0;
$member_handler = &xoops_gethandler( 'member' );
$user = &$member_handler->getUser( $userid );
$name = '';
if ( is_object( $user ) ) {
if ( $is_linked ) {
$url = XOOPS_URL . '/userinfo.php?uid=';
$name .= '<a href="' . $url . $userid . '">';
}
$name .= ( intval( $usereal ) && $user->getVar( 'name' ) != '' ) ? $user->getVar( 'name' ) : $user->getVar( 'uname' );
if ( $is_linked ) {
$name .= '</a>';
}
} else {
$name = $GLOBALS['xoopsConfig']['anonymous'];
}
return $name;
}
untested code though.
(sry about my 8 space tabs..)
“There is nothing impossible to him who will try.” ~Alex The Great~
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯