Very useful info, thanks. I have permissions working properly for different usergroups within my hack, but I haven't been able to figure out how to put usergroup ids that have a certain setting into a string for use as a conditional query. For instance...
I have a y/n bitfield usergroup permission set up as:
$permissions['myhackperms'] & $vbulletin->bf_ugp_myhackperms['canfoo']
and I want to run a query on which users have bitfield 'canfoo' set to yes? regardless of what usergroup they're in.
PHP Code:
$sql = $db->query_read("
SELECT usergroup.usergroupid, usergroup.myhackperms
FROM " . TABLE_PREFIX . "usergroup
WHERE canfoo = 1
");
then after the result of this, i can put the usergroupids into a string and query which users are members of the usergroups in the string...
I know the query to get the usergroupids is wrong, it's due to me not knowing how to decode the bitfield, is there a function already written which vb uses to do these kinds of things? If so can someone point it out please?