SimplePortal
Customization => Custom Coding => Topic started by: Manu on November 22, 2009, 05:36:01 AM
-
Hi,
is there a way to exclude banned members in the top poster block?
I know I could use other options for the top poster block, like "This week" but we want to show "All Time", but our problem is, the member at position 1 is a banned member.
Is there a way not to show banned members in this block?
-
Any idea? :-[
-
Moved to the custom coding board.
This edit is for SMF1.1 only.
$request = db_query("
SELECT
mem.ID_MEMBER, mem.realName, COUNT(*) as posts,
mem.avatar, a.ID_ATTACH, a.attachmentType, a.filename
FROM {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE m.posterTime > $start_time
AND m.ID_MEMBER != 0
GROUP BY mem.ID_MEMBER
ORDER BY posts DESC
LIMIT $limit", __FILE__, __LINE__);
}
else
{
$request = db_query("
SELECT
m.ID_MEMBER, m.realName, m.posts, m.avatar,
a.ID_ATTACH, a.attachmentType, a.filename
FROM {$db_prefix}members as m
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
ORDER BY posts DESC
LIMIT $limit", __FILE__, __LINE__);
}
$request = db_query("
SELECT
mem.ID_MEMBER, mem.realName, COUNT(*) as posts,
mem.avatar, a.ID_ATTACH, a.attachmentType, a.filename
FROM {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE m.posterTime > $start_time
AND m.ID_MEMBER != 0
AND mem.is_activated < 10
GROUP BY mem.ID_MEMBER
ORDER BY posts DESC
LIMIT $limit", __FILE__, __LINE__);
}
else
{
$request = db_query("
SELECT
m.ID_MEMBER, m.realName, m.posts, m.avatar,
a.ID_ATTACH, a.attachmentType, a.filename
FROM {$db_prefix}members as m
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE mem.is_activated < 10
ORDER BY posts DESC
LIMIT $limit", __FILE__, __LINE__);
}
-
Thx for your help, but when I insert the code you posted, I get this error message when I try to set the block to "All Time"
Unknown column 'mem.is_activated' in 'where clause'
File: /is/htdocs/.../.../.../Sources/PortalBlocks.php
Line: 538
:-[
-
Whoops, the members table has a different prefix for the second query, try the replace code below.
$request = db_query("
SELECT
mem.ID_MEMBER, mem.realName, COUNT(*) as posts,
mem.avatar, a.ID_ATTACH, a.attachmentType, a.filename
FROM {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE m.posterTime > $start_time
AND m.ID_MEMBER != 0
AND mem.is_activated < 10
GROUP BY mem.ID_MEMBER
ORDER BY posts DESC
LIMIT $limit", __FILE__, __LINE__);
}
else
{
$request = db_query("
SELECT
m.ID_MEMBER, m.realName, m.posts, m.avatar,
a.ID_ATTACH, a.attachmentType, a.filename
FROM {$db_prefix}members as m
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = m.ID_MEMBER)
WHERE m.is_activated < 10
ORDER BY posts DESC
LIMIT $limit", __FILE__, __LINE__);
}
-
Oops :-[
Now I get this message when I want to enter the Adminsection
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /is/htdocs/.../.../.../Sources/PortalBlocks.php on line 1264
Parse error: syntax error, unexpected '/' in /is/htdocs/.../.../.../Sources/PortalBlocks.php on line 1264
-
What exactly is located on line 1264 of your PortalBlocks.php file?
-
Line 1264
<form action="', $boardurl, '/SSI.php?ssi_function=pollVote" method="post" accept-charset="', $context['character_set'], '">
-
Hmm, I'm not sure why that line would be causing that error, can you attach your entire PortalBlocks.php file?
-
Hmm, I'm not sure why that line would be causing that error, can you attach your entire PortalBlocks.php file?
Sorry, I made a mistake by adding the code :-[
Is it possible to provide me with the code for SMF 2.0.1?
I'm working on the upgrade and need to exclude banned members on the Top-Poster Block :)
-
Attach ./Sources/PortalBlocks.php
-
Attach ./Sources/PortalBlocks.php
The code Nathaniel showed here is only for installed portals on SMF 1.x.x :)
I need it for SMF 2.x.x :)
-
Yes, I am aware of this. Please attach your file so I can make the edits for SMF 2.0
-
Yes, I am aware of this. Please attach your file so I can make the edits for SMF 2.0
Here's my actual PortalBlocks.php thanks for your help :)
-
Find:
WHERE m.poster_time > {int:start_time}
AND m.id_member != 0
Replace with:
WHERE m.poster_time > {int:start_time}
AND m.id_member != 0
AND m.is_activated < 10