function shoutbox_get_user_link in Shoutbox 6.2
Same name and namespace in other branches
- 7.2 shoutbox.module \shoutbox_get_user_link()
- 7 shoutbox.module \shoutbox_get_user_link()
Generate a linked user name for displaying on a shout post
Parameters
$shout: A shout object
Return value
A user name which links to the user profile
1 call to shoutbox_get_user_link()
- theme_shoutbox_post in ./
shoutbox.theme.inc - Theme function for shoutbox posts.
File
- ./
shoutbox.module, line 289 - Shout box module displays a block for users to create short messages for the whole site. Uses AHAH to update the database and display content.
Code
function shoutbox_get_user_link($shout) {
$link = '';
if ($shout->uid > 0) {
// See if we can use a custom profile field for the name
if ($field = variable_get('shoutbox_profile_name', '')) {
$name = db_result(db_query("\n SELECT v.value FROM {profile_values} v INNER JOIN {profile_fields} f ON v.fid = f.fid\n WHERE f.name = '%s' AND v.uid = %d", $field, $shout->uid));
$shout->nick = $name ? $name : $shout->nick;
}
}
// Build object that theme_username can use
$object = new stdClass();
$object->uid = $shout->uid;
$object->name = $shout->nick;
return theme('username', $object);
}