I am using a system (concrete5) to edit some php in place. I am trying the following:
use Concrete\Core\User\UserInfo;
$ui = UserInfo::getByID(3);
$answer = $ui->getAttribute('Q1');
if ($answer >= 5)
print "True";
When I insert a check on $answer
by inserting print $answer
, it returns 6 (this is attribute data held on the user). However, the if
does not evaluate to true. And ideas why? Must I typeset the output or something?
Edit: I typecast to int with the same result.
The selected answer is not the proper approach.
Use $ui->getAttribute('Q1','display')
.
use Concrete\Core\User\UserInfo;
$ui = UserInfo::getByID(3);
$answer = $ui->getAttribute('Q1','display');
if ($answer >= 5)
print "True";
See concrete5 documentation to know more about attributes- https://documentation.concrete5.org/developers/attributes/attribute-value-objects-and-output-formatting