I didn't say that it's a best method. I just pointed at a location. As for your method, which is
definitely better, the most error-proof solution would be simply:
PHP Code:
if(!(is_member_of($this->registry->userinfo, X) OR is_member_of($this->registry->userinfo, Y)))
{
$dobbimagecode = false;
}
Whereas the "true" assignment in your code might cause unexpected behavior in some cases when imgcode should not be parsed.
The easiest to use modify code would be:
PHP Code:
$usergroupids_no_img = 'X,Y,Z';
$usergroupids_no_img = explode(',', $usergroupids_no_img);
foreach ($usergroupids_no_img as $usergroupid)
{
if(!is_member_of($this->registry->userinfo, $usergroupid))
{
$dobbimagecode = false;
break;
}
}
The reason there is a break statement is to stop checking for usergroups once a restricted one has been found - in other words, for optimization.