Email and name should be called from user table:
Code:
//<code>
$user = JFactory::getUser();
$db = JFactory::getDbo();
$userId = $user->get('id');
// Is the user logged in?
if ($userId) {
// Grab the value from the database.
$db->setQuery("SELECT `email` FROM `#__users` WHERE `id`='".$userId."'");
return $db->loadResult();
}
//</code>
Code:
//<code>
$user = JFactory::getUser();
$db = JFactory::getDbo();
$userId = $user->get('id');
// Is the user logged in?
if ($userId) {
// Grab the value from the database.
$db->setQuery("SELECT `name` FROM `#__users` WHERE `id`='".$userId."'");
return $db->loadResult();
}
//</code>