Posted on: 09/06/05 04:32pm
By: orfilms
Posted on: 09/07/05 12:21am
By: machinari
//displays top ten article posters by number of articles posted. function phpblock_article_posters() { global $_TABLES, $_CONF; //basic select $query = "SELECT a.uid, COUNT(*) as count, b.username FROM {$_TABLES['stories']} a, {$_TABLES['users']} b"; //get username and don't retrieve anonymous users $query .= " WHERE a.uid=b.uid AND a.uid>'1'"; //check access $query .= COM_getPermSQL('and'); //list users only once $query .= " GROUP BY a.uid"; //order by number of stories to that user--desc $query .= " ORDER BY count DESC"; //limit to highest 10 posters $query .= " LIMIT 10"; //run query $result = DB_query($query); if (DB_numRows($result) > 0){ //loop thru result $retval = ''; while ($A = DB_fetchArray($result)){ //display a username and profile link for each result $retval .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid='; $retval .= $A['uid'] . '">' . $A['username'] . '</a> (' . $A['count'] . ')' . LB; } return $retval; } else return; }
Posted on: 09/07/05 12:30am
By: orfilms
Posted on: 09/07/05 12:51am
By: machinari
//displays top ten article posters by number of articles posted. function phpblock_article_posters() { global $_TABLES, $_CONF; //basic select $query = "SELECT a.uid, COUNT(*) as count, b.username FROM {$_TABLES['stories']} a, {$_TABLES['users']} b"; //get username $query .= " WHERE a.uid=b.uid AND a.uid>'1'"; //results just for last 30 days $query .= " AND date >= date_sub(NOW(), INTERVAL 1 MONTH) AND date <= NOW()"; //check access $query .= " AND draft_flag='0'" . COM_getPermSQL('AND'); //list users only once $query .= " GROUP BY a.uid"; //order by number of stories to that user--desc $query .= " ORDER BY count DESC"; //limit to highest 10 posters $query .= " LIMIT 10"; //run query $result = DB_query($query); if (DB_numRows($result) > 0){ //loop thru result $retval = ''; while ($A = DB_fetchArray($result)){ //display a username and profile link for each result $retval .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid='; $retval .= $A['uid'] . '">' . $A['username'] . '</a> (' . $A['count'] . ')' . LB; } return $retval; } else return; }
Posted on: 09/07/05 01:48am
By: orfilms