Hi
Trying to autopopulate a field in RS Forms using following script
Works fine for most CB fields except email and name fields get following error
1054 Unknown column 'email' in 'field list'
Any help would be appreciated
// Is the user logged in?
if ($userId) {
// Grab the value from the database.
$db->setQuery("SELECT `firstname` FROM `#__comprofiler` WHERE `user_id`='".$userId."'");
return $db->loadResult();
}
//</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>
The following user(s) said Thank You: nant, krileon