Many moons ago I had gotten some code to make a block which emoved the avatars, and added the code for the admins NOT to be included, we talk too much and can't win the prizes offered....LOL
Yes, I did try it, too old so it no workie right. Can someone rig up the code so that I can insert it or remove what is not needed by our asylum??
If you provide the code that does not work we may be able to fix it , without that it is only guessing what you want to do
The search function worked fine for me... I assume this was the code you referred to (?), and I just pasted this in a PHP block in my 2.0.17 forum and it works fine...
Quote from: IchBin on February 09, 2014, 04:10:48 AM
Well I just tried this code and it worked fine:
global $smcFunc, $scripturl, $modSettings, $context;
// Number of top posters displayed
$topPoster = 45;
// Find the latest poster.
$request = $smcFunc['db_query']('', '
SELECT mem.id_member, mem.show_online, mem.real_name, mem.posts, a.id_attach, a.attachment_type, a.filename
FROM ({db_prefix}members as mem)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE ' .($context['user']['is_admin'] ? '1' : 'show_online = 1') . '
ORDER BY posts DESC
LIMIT {int:limit}',
array('limit' => $topPoster)
);
$users = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$users[] = array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'posts' => $row['posts'],
'show' => $row['show_online'],
);
}
$smcFunc['db_free_result']($request);
// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="10">';
foreach ($users as $user)
{
$admins = array(1,2);
if (in_array($user['id'], $admins))
continue;
echo '
<tr>
<td><h5 style="margin: 4px,0,0,4px;">'.$user['link'].'</h5></td><td><h5 style="margin: 4px,0,0,4px;">'. $user['posts'] .'</h5></td>
</tr>';
}
echo '
</table>';
Note that the exclusion on admins is by poster ID (1 and 2) so you need to adapt this array if you have other users you wish to exclude now...
$admins = array(1,2)
thank you so much y'all. I have been fighting this sight for ages and now I need to remember how to shrink the font size to fit into the block better.
This was the code I had and used but the silly thing would not work and gave errors. It works great just text is too big.
I saw the code uses the H5 tag, you can change that...
This is for example with the regular font size and 20 top posters:
global $smcFunc, $scripturl, $modSettings, $context;
// Number of top posters displayed
$topPoster = 20;
// Find the latest poster.
$request = $smcFunc['db_query']('', '
SELECT mem.id_member, mem.show_online, mem.real_name, mem.posts, a.id_attach, a.attachment_type, a.filename
FROM ({db_prefix}members as mem)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE ' .($context['user']['is_admin'] ? '1' : 'show_online = 1') . '
ORDER BY posts DESC
LIMIT {int:limit}',
array('limit' => $topPoster)
);
$users = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$users[] = array(
'id' => $row['id_member'],
'name' => $row['real_name'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'posts' => $row['posts'],
'show' => $row['show_online'],
);
}
$smcFunc['db_free_result']($request);
// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="10">';
foreach ($users as $user)
{
$admins = array(1,2);
if (in_array($user['id'], $admins))
continue;
echo '
<tr>
<td>'.$user['link'].'</td><td style="text-align:right;min-width:4em;">'. $user['posts'] .'</td>
</tr>';
}
echo '
</table>';
Thanks ever so much, looks fantastic now and we admins are not in there, one of the prizes is nice too... :2funny:
Marking this solved then
Thanks I always forget that.