Hi All,
I've been looking at my code on some of the programs I've wrote over the years and obviously I'm going to have to rewrite those bits that involve getting information from the extended user table from WebLoginPE and Evo2 FormLister.
Whilst I have a function which serves the purposes I'm hoping there is already a function in Evo which will return all the TV's applicable to the users Role?
So far my function is:
{
$modx = EvolutionCMS();
$sql = "SELECT t4.name, t3.value
FROM ".$modx->getFullTableName('users')." t1
INNER JOIN ".$modx->getFullTableName('user_attributes')." t2 ON t1.id = t2.internalKey
INNER JOIN ".$modx->getFullTableName('user_values')." t3 ON t1.id = t3.userid
INNER JOIN ".$modx->getFullTableName('site_tmplvars')." t4 ON t4.id = t3.tmplvarid
INNER JOIN ".$modx->getFullTableName('user_roles')." t5 ON t5.id = t2.role
WHERE t1.id=".$user.";";
$rs = $modx->db->query($sql);
while ( $row = $modx->db->getRow($rs) )
{
// Put each record into it's own key
$data[$row['name']] = $row['value'];
}
return $data;
}```
Is there a builtin function like getTemplateVarOutput?