Main Menu
collapse

Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

User Info

Welcome Guest.
Please log in.

Who's Online

  • Dot Guests: 977
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]


Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Exclude banned members in "Top Poster" Block

Started by Manu, November 22, 2009, 05:36:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Manu

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?
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Manu

Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Nathaniel

Moved to the custom coding board.


This edit is for SMF1.1 only.

Code ("Find (Sources/PortalBlocks.php)") Select
      $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__);
   }


Code ("Replace") Select
      $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__);
   }
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Manu

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"

QuoteUnknown column 'mem.is_activated' in 'where clause'
File: /is/htdocs/.../.../.../Sources/PortalBlocks.php
Line: 538

:-[
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Nathaniel

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__);
   }
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Manu

Oops  :-[

Now I get this message when I want to enter the Adminsection

QuoteWarning:  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
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Nathaniel

What exactly is located on line 1264 of your PortalBlocks.php file?
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Manu

Line 1264

<form action="', $boardurl, '/SSI.php?ssi_function=pollVote" method="post" accept-charset="', $context['character_set'], '">
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Nathaniel

Hmm, I'm not sure why that line would be causing that error, can you attach your entire PortalBlocks.php file?
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Manu


Quote from: Nathaniel on December 12, 2009, 08:19:28 PM
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 :)
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

ccbtimewiz


Manu

Quote from: Genis Sage on October 28, 2011, 04:18:28 PM
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 :)
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

ccbtimewiz

Yes, I am aware of this. Please attach your file so I can make the edits for SMF 2.0

Manu

Quote from: Lyra on November 01, 2011, 03:18:22 PM
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 :)
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

ccbtimewiz

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