PDA

View Full Version : Include/recognize secondary usergroups in plugin code...


TFEX
04-18-2010, 11:01 PM
Hey peoples. I'm using a wonderful little mod that allows me to allow certain usergroups (comma-separated ID's) to receive PM's, even if the sending usergroup is restricted to a certain post-count before sending them.

Only trouble is the plugin that handles the field only identifies and recognizes primary groups, and I'd like to be able to chop in a little something so I can have it recognize secondary ID's also.

This is the plugin code I'd need to edit... I think... lol:

$apboupc_get_allowedrecs = $vbulletin->db->query_read("
SELECT userid, username, usergroupid
FROM `" . TABLE_PREFIX . "user` AS user
WHERE `usergroupid` IN (".$vbulletin->options['apboupc_pm_allowed'].")
");

Yes, this is cyb's advanced PM permissions hack for 3.7. It is in all ways perfect for my board, except for this one adjustment I would love to make to the above code for my own purposes. I have one secondary usergroup on my boards that I'd really like newbies to be able to PM immediately.

Now I do understand that secondary ID's are listed in 'membergroupids', but I would be stabbing in the dark if I tried anything on my own really. I'm not much of a coder... yet... but I know all I need to do is pull ID's from that column of the table also, in such a way that they can be recognized, even if a user is in multiple secondary usergroups.

Can anyone throw me suggestions as to what I could do up there? Is this possible?

--------------- Added 1271684922 at 1271684922 ---------------

Made it work for the time being by simply adding:

OR FIND_IN_SET('X', membergroupids)

to the code above.

I still wouldn't mind knowing the php required to make the comma separated field in the mod itself be able to incorporate secondary ID's also... I've been reading all about loops and arrays and such... do they apply in this kind of situation?