许多用户的问题都有谁喜欢这个故事的名字 那么如何根据投票人数的已发布链接对用户进行排序。
libs / htm1.php中的
function who_voted($storyid, $avatar_size){
// this returns who voted for a story
// eventually add support for filters (only show friends, etc)
global $db;
if (!is_numeric($storyid)) die();
$sql = 'SELECT ' . table_votes . '.*, ' . table_users . '.* FROM ' . table_votes . ' INNER JOIN ' . table_users . ' ON ' . table_votes . '.vote_user_id = ' . table_users . '.user_id WHERE (((' . table_votes . '.vote_value)>0) AND ((' . table_votes . '.vote_link_id)='.$storyid.') AND (' . table_votes . '.vote_type= "links")) AND user_level<>"god" AND user_level<>"Spammer"';
//echo $sql;
$voters = $db->get_results($sql);
$voters = object_2_array($voters);
foreach($voters as $key => $val){
$voters[$key]['Avatar_ImgSrc'] = get_avatar($avatar_size, "", $val['user_login'], $val['user_email']);
}
return $voters;
我在topusers.php中找到了这些行,但是没有正确编写函数的友好体验
case 2: // sort users by number of published links
$select = "SELECT user_id, count(*) as count ";
$from_where = " FROM " . table_links . ", " . table_users . " WHERE link_status = 'published' AND link_author=user_id AND user_level NOT IN ('god','Spammer') AND (user_login!='anonymous' OR user_lastip) GROUP BY link_author";
$order_by = " ORDER BY count DESC ";
break;