Log in

View Full Version : selecting usergroups based off custom ugp


Nullifi3d
02-15-2008, 05:25 AM
$usergroups = $db->query_first("SELECT usergroupid FROM " . TABLE_PREFIX . "usergroup WHERE fmwpermissions > '0'");
$website = $db->query_first("SELECT homepage AS url, homepagetitle AS title FROM " . TABLE_PREFIX . "user WHERE usergroupid IN (" . $usergroups . ") AND homepage != '' AND last" . $vbulletin->options['fmw_last_activity_type'] . " > UNIX_TIMESTAMP(NOW())-" . $vbulletin->options['fmw_last_activity_time'] . " ORDER BY RAND() LIMIT 1");
The first query does not give me the needed results. I am looking for a way of the second query contains a list of usergroups that have a certain custom ugp set to yes.

Sorry forgot to add that this is a plugin within forumhome_loggedinuser

Opserty
02-15-2008, 08:17 AM
Just a word of warning...you running a query every time a logged in member is displayed on the homepage. If you have 54 members logged in then thats 54 queries in a single page, if two people load the homepage thats 108 queries, you can see it grows very rapidly!

Nullifi3d
02-16-2008, 01:59 AM
I guess I didn't look very far into the plugin being used. Thanks for pointing this out. I moved the query to 'forumhome_complete'. But the issue with finding the usergroups that have permission still exists.