zamiast tamtego co dawales w functions.php daj
Kod:
function top_posters($str_input, $show_admin, $show_mod)
{
global $db, $phpEx, $theme;
// Show All
if ( ( $show_admin == '1' ) && ( $show_mod == '1' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id)
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Admin But Not Moderators
elseif ( ( $show_admin == '1' ) && ( $show_mod == '0' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . MOD . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Moderators But Not Admins
elseif ( ( $show_admin == '0' ) && ( $show_mod == '1' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . ADMIN . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
// Show Neither Admins Nor Moderators
else/// ( ( $show_admin == '0' ) && ( $show_mod == '0' ) )
{
$sql = "SELECT u.user_id, u.username, u.user_posts, u.user_rank, count(u.user_id) as user_posts
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p
WHERE (u.user_id <> " . ANONYMOUS . ") AND (u.user_id = p.poster_id) AND (u.user_level != " . ADMIN . ") AND (u.user_level != " . MOD . ")
GROUP BY user_id, username
ORDER BY user_posts DESC
LIMIT $str_input";
}
//
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query forum top poster information', '', __LINE__, __FILE__, $sql);
}
// $top_posters = array();
while( $row = $db->sql_fetchrow($result) )
{
$top_posters .= color_username($row['user_id'],$row['username'],$row['user_rank'],$row['user_posts']) . ' ('.$row['user_posts'].'), ';
}
return $top_posters;
}
Autor postu otrzymał pochwałę
Wymiana linków - Wypozycjonuj za darmo swoją strone!