The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Featured Album Pics from active members only
Hi
I use a module to show featured album pics on several of my site pages These are displayed at random However what I would like to do is show random pics but only from member that have been logged in during the last 30 days. That's not the same thing as pics that have been added in the last thirty days - the pics could be over a year old, as long as the members has been logged in recently they should be candidates for display The current SQL is Code:
$orderby = "rand(NOW())"; $lpictures = $db->query_read(" SELECT albumpicture.*, album.*, user.username, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "albumpicture AS albumpicture LEFT JOIN " . TABLE_PREFIX . "album AS album ON(album.albumid = albumpicture.albumid) LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = album.userid) WHERE album.state = 'public' ORDER BY $orderby DESC LIMIT 0, $tot "); Thanks Rich |
#2
|
|||
|
|||
I think you could do something like this:
Code:
$orderby = "rand(NOW())"; $cutoff = TIMENOW - (30 * 86400); // 86400 = seconds in one day $lpictures = $db->query_read(" SELECT albumpicture.*, album.*, user.username, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "albumpicture AS albumpicture LEFT JOIN " . TABLE_PREFIX . "album AS album ON(album.albumid = albumpicture.albumid) LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = album.userid) WHERE album.state = 'public' AND user.lastvisit > $cutoff ORDER BY $orderby DESC LIMIT 0, $tot "); |
#3
|
||||
|
||||
Working great! Thanks
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|