Get an Admin / FEU user's Full Name
Posted: Fri Feb 26, 2010 10:46 am
I needed CGBlog to display a user's full name instead of their username, so I created this tag, called GetFullName
it does require the username as a parameter though.
Next, you can use it in your CGBlog templates like this:
You can probably use it as well in modules like News
Hope somebody else finds this useful, thanks to Stikki for the help in making it work
it does require the username as a parameter though.
Code: Select all
global $gCms;
$db =& $gCms->GetDb();
$user_name = $params['username'];
$query = "SELECT first_name, last_name FROM ".cms_db_prefix()."users WHERE username=?";
$row = $db->GetRow($query, array($user_name));
if($row)
{
$result = $row['first_name'] . " " . $row['last_name'];
}
else
{
$result = "Username: $user_name doesn't exist";
}
return $result;
Code: Select all
<div class="CGBlogPostAuthor">{GetFullName username=$entry->author}</div>
Hope somebody else finds this useful, thanks to Stikki for the help in making it work
