Hi guys
Do anyone know how to get the Author full name in LISE?
Things I tried in the template
owner: {$item->owner} This only gives me the uid of the user.
{cms_admin_user uid={$item->owner} mode=fullname} This only works in the backend.
{PostAuthor username=$item->owner} gives me user not found.
Thank you.
LISE get Author variable
-
- Forum Members
- Posts: 155
- Joined: Thu Aug 20, 2020 10:49 pm
-
- Forum Members
- Posts: 155
- Joined: Thu Aug 20, 2020 10:49 pm
Re: LISE get Author variable
For now I would have to use this. But not good if we have to add more users.
Code: Select all
{if $item->owner == '1'}
user full name 1
{elseif $item->owner == '2'}
user full name 2
{elseif $item->owner == '3'}
user full name 3
{/if}
Re: LISE get Author variable
Here's a UDT you can use to get the admin user's full name. Call it get_admin_name:
Then in your LISE template you should be able to use {get_admin_name user_id=$item->owner}
Code: Select all
$gCms = cmsms();
$db = $gCms->GetDb();
$user_id = $params['user_id'];
$query = "SELECT first_name, last_name FROM ". cms_db_prefix() . "users WHERE user_id=?";
$row = $db->GetRow($query, array($user_id));
if($row)
{
$result = $row['first_name'] . " " . $row['last_name'];
}
else
{
$result = "User ID: $user_id doesn't exist";
}
return $result;
Not getting the answer you need? CMSMS support options
-
- Forum Members
- Posts: 155
- Joined: Thu Aug 20, 2020 10:49 pm
Re: LISE get Author variable (Solved)
Thank you so much that work great.