Accessing FrontEnd User properties in Logout Template
Posted: Fri Mar 04, 2011 4:59 pm
I am running CMS made simple 1.9.3, php 5.3.5, mysql 5.1.55, apache 2.2.17 on fedora 14. I have the modules FrontEndUser version 1.12.12 and CustomContent version 1.7.3 installed
In the logout form I would like to replace the $username with the property of the logged in user's first name. I am encrypting the users first and last name in the DB.
I've done several hours of Google searches but I have not been able to find a solution that works.
First I created a UDT called get_properties with the following:
global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
if( $feusers )
{
$uid = $feusers->LoggedInId();
$properties = $feusers->GetUserProperties($uid);
$firstname= ( $properties [1][data]);
$lastname= ( $properties [2][data]);
$email= ( $properties [3][data]);
$phone= ( $properties [4][data]);
$smarty->assign('firstname',$firstname);
$smarty->assign('lastname',$lastname);
$smarty->assign('email',$email);
$smarty->assign('phone',$phone);
}
Here is an example of what I've tried in the FrontEnd User logout template:
{get_properties}
<!-- Logout form template -->
<p>{$prompt_loggedin} {$firstname}</p>
<p><a href="{$url_logout}" title="{$mod->Lang('info_logout')}">{$mod->Lang('logout')}</a></p>
<!-- Logout form template -->
In the logout form I would like to replace the $username with the property of the logged in user's first name. I am encrypting the users first and last name in the DB.
I've done several hours of Google searches but I have not been able to find a solution that works.
First I created a UDT called get_properties with the following:
global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
if( $feusers )
{
$uid = $feusers->LoggedInId();
$properties = $feusers->GetUserProperties($uid);
$firstname= ( $properties [1][data]);
$lastname= ( $properties [2][data]);
$email= ( $properties [3][data]);
$phone= ( $properties [4][data]);
$smarty->assign('firstname',$firstname);
$smarty->assign('lastname',$lastname);
$smarty->assign('email',$email);
$smarty->assign('phone',$phone);
}
Here is an example of what I've tried in the FrontEnd User logout template:
{get_properties}
<!-- Logout form template -->
<p>{$prompt_loggedin} {$firstname}</p>
<p><a href="{$url_logout}" title="{$mod->Lang('info_logout')}">{$mod->Lang('logout')}</a></p>
<!-- Logout form template -->