collapse 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 login or register.

* Who's Online

  • Dot Guests: 169
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* 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]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: TOP - Posts, Karmas and Money (SMF Shop)  (Read 33815 times)

0 Members and 1 Guest are viewing this topic.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
TOP - Posts, Karmas and Money (SMF Shop)
« on: April 29, 2009, 09:49:13 PM »
[FOR SMF 2.0 ONLY]

Hi :)

I wanted a mod that could join all the TOP I used: Top Posts, Top Karmas and Top Money (SMF Shop)

So, I decided to do one. Here it is:

Updated: HTML Validity - Thanks to [SiNaN]

Without TOP Money (Use this if you don't have SMF Shop)
Code: [Select]
//TOP POSTS

   //TOP POSTS [TITLE]
   echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <img src="http://img527.imageshack.us/img527/3337/86263199.gif" alt="posts" />
   <strong>Top Posts</strong>
</div>
   <hr />';
   
   // TOP POSTS [CODE]
   global $boarddir, $memberContext;

   require_once($boarddir.'/SSI.php');

   $top_given = ssi_topPoster(3, 'array');

   echo '<table>';

   foreach ($top_given as $member)
   {
      loadMemberData($member['id']);
      loadMemberContext($member['id']);

      echo '
      <tr>
        <td style="width: 55px; text-align: center;">', !empty($memberContext[$member['id']]['avatar']['href']) ? '
          <img src="' . $memberContext[$member['id']]['avatar']['href'] . '" alt="' . $member['name'] . '" width="30" height="27" />' : '', '
        </td>
        <td>
          ', $member['link'], '<br />
          <span class="smalltext">
            <strong>Posts:</strong> ', $member['posts'], '
          </span>
        </td>
      </tr>';
   }
   echo '
   </table>';

echo'   
<br />';
   
//TOP KARMAS

   //TOP KARMAS [TITLE]
echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <img src="http://img2.imageshack.us/img2/419/85312373.gif" alt="karma" />
   <strong>Top Karmas</strong>
</div>
   <hr />';

   // TOP KARMAS [CODE]
global $smcFunc, $scripturl, $memberContext;

$members_result = $smcFunc['db_query']('', '
   SELECT id_member, real_name, karma_good
   FROM {db_prefix}members
   ORDER BY karma_good DESC
   LIMIT 3');
$members = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
   $members[] = array(
      'name' => $row_members['real_name'],
      'id' => $row_members['id_member'],
      'karma' => $row_members['karma_good'],
      'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
   );
}
$smcFunc['db_free_result']($members_result);

if (empty($members))
   return;
   
echo '<table>';   

foreach ($members as $karma) {
   echo '
   <tr>
      <td style="width: 55px; text-align: center;">', !empty($memberContext[$karma['id']]['avatar']['href']) ? '
         <img src="' . $memberContext[$karma['id']]['avatar']['href'] . '" alt="' . $karma['name'] . '" width="30" height="27" />' : '', '
      </td>
      <td>
         ', $karma['link'], '<br />
          <span class="smalltext">
            <strong>Karmas:</strong> ', $karma['karma'], '
          </span>
      </td>
   </tr>';

echo '
</table>';

With TOP Money (only if you have SMF Shop)
Code: [Select]
//TOP POSTS

   //TOP POSTS [TITLE]
   echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <img src="http://img527.imageshack.us/img527/3337/86263199.gif" alt="posts" />
   <strong>Top Posts</strong>
</div>
   <hr />';
   
   // TOP POSTS [CODE]
   global $boarddir, $memberContext;

   require_once($boarddir.'/SSI.php');

   $top_given = ssi_topPoster(3, 'array');

   echo '<table>';

   foreach ($top_given as $member)
   {
      loadMemberData($member['id']);
      loadMemberContext($member['id']);

      echo '
      <tr>
        <td style="width: 55px; text-align: center;">', !empty($memberContext[$member['id']]['avatar']['href']) ? '
          <img src="' . $memberContext[$member['id']]['avatar']['href'] . '" alt="' . $member['name'] . '" width="30" height="27" />' : '', '
        </td>
        <td>
          ', $member['link'], '<br />
          <span class="smalltext">
            <strong>Posts:</strong> ', $member['posts'], '
          </span>
        </td>
      </tr>';
   }
   echo '
   </table>';

echo'   
<br />';
   
//TOP KARMAS

   //TOP KARMAS [TITLE]
echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <img src="http://img2.imageshack.us/img2/419/85312373.gif" alt="karma" />
   <strong>Top Karmas</strong>
</div>
   <hr />';

   // TOP KARMAS [CODE]
global $smcFunc, $scripturl, $memberContext;

$members_result = $smcFunc['db_query']('', '
   SELECT id_member, real_name, karma_good
   FROM {db_prefix}members
   ORDER BY karma_good DESC
   LIMIT 3');
$members = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
   $members[] = array(
      'name' => $row_members['real_name'],
      'id' => $row_members['id_member'],
      'karma' => $row_members['karma_good'],
      'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
   );
}
$smcFunc['db_free_result']($members_result);

if (empty($members))
   return;
   
echo '<table>';   

foreach ($members as $karma) {
   echo '
   <tr>
      <td style="width: 55px; text-align: center;">', !empty($memberContext[$karma['id']]['avatar']['href']) ? '
         <img src="' . $memberContext[$karma['id']]['avatar']['href'] . '" alt="' . $karma['name'] . '" width="30" height="27" />' : '', '
      </td>
      <td>
         ', $karma['link'], '<br />
          <span class="smalltext">
            <strong>Karmas:</strong> ', $karma['karma'], '
          </span>
      </td>
   </tr>';

echo '
</table>';

   // TOP MONEY [CODE]
global $smcFunc, $scripturl, $memberContext;

$members_result = $smcFunc['db_query']('', '
   SELECT id_member, real_name, money
   FROM {db_prefix}members
   ORDER BY money DESC
   LIMIT 3');
$members = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
   $members[] = array(
      'name' => $row_members['real_name'],
      'id' => $row_members['id_member'],
      'money' => $row_members['money'],
      'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
   );
}
$smcFunc['db_free_result']($members_result);

if (empty($members))
   return;

echo '<table>'; 
   
foreach ($members as $money) {
   echo '
   <tr>
      <td style="width: 55px; text-align: center;">', !empty($memberContext[$money['id']]['avatar']['href']) ? '
         <img src="' . $memberContext[$money['id']]['avatar']['href'] . '" alt="' . $money['name'] . '" width="30" height="27" />' : '', '
      </td>
      <td>
         ', $money['link'], '<br />
          <span class="smalltext">
            <strong>Money:</strong> ', $money['money'], '
          </span>
      </td>
   </tr>';
}
echo '
</table>';

ScreenShot Attached. Hope you like it ;)
« Last Edit: July 05, 2011, 03:36:57 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #1 on: April 30, 2009, 01:49:35 AM »
Looks good. Moved to the Blocks and Modifications board. :)
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.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #2 on: April 30, 2009, 04:28:45 AM »
Thanks ;D
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline aceflybye

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • Life is Art - Art is Life
    • AceFlyBye.com
  • SMF Version: None
  • SP Version: None
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #3 on: May 05, 2009, 01:04:52 AM »
Thank you, awesome job did you get smf shop on 2.0 rc1

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #4 on: May 05, 2009, 05:16:27 AM »
Good job Blue! Looks great.

Here are some suggestions to make it perfect.

For this code:

Code: [Select]
<center><img src="http://img259.imageshack.us/img259/7306/yen.png" align="abscenter" > <span class="smalltext"><font color="#216095"><b>Top Money</b></font></span></center>
I'd have used this:

Code: [Select]
<div class="smalltext" style="text-align: center; color: #216095;">
<img src="http://img259.imageshack.us/img259/7306/yen.png" alt="money" />
<strong>Top Money</strong>
</div>

So you put everything in a div which has smalltext class assigned and text inside is aligned to center by text-align: center; and text color is set with color: #216095;.

With this, you can get rid of deprecated tags (center and font) and an extra span tag. In addition, you won't need to use align attribute for img tag, which is also decprecated, as text-align: center; for the div would align it to center too. Also, instead of deprecated tag, b, you can use strong. Lastly, img tag requires alt attribute to be HTML valid.

Also, instead of <hr> use <hr /> and for <br/ > or <br> use <br />, again for HTML validity.
And slowly, you come to realize... It's all as it should be...

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #5 on: May 05, 2009, 07:11:16 AM »
 :0 Didn't knew about HTML validity

I'm going to change that, then :) -----> Done ;)

Thanks for the "teaching lessons" ;D I'm learning, I'm learning :D

The <div> thing is cool. At least the code becomes more eye looking :P
« Last Edit: May 05, 2009, 07:20:15 AM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #6 on: May 05, 2009, 07:26:11 AM »
Looks great, well done! You're learning fast. :D
And slowly, you come to realize... It's all as it should be...

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #7 on: May 05, 2009, 07:31:22 AM »
I'm a quick learner, I told you on the other topic eheh :P

Any problem if my next block be a "Shoutbox Smart Block" (with detection of the shoutbox installed?) :-[
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #8 on: May 05, 2009, 07:32:39 AM »
Of course not, you can code whatever you like. ;)

Also, while creating "smart blocks" you can cheat from built-in "intelligent blocks" of SimplePortal. ;P
And slowly, you come to realize... It's all as it should be...

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #9 on: May 05, 2009, 07:40:56 AM »
Also, while creating "smart blocks" you can cheat from built-in "intelligent blocks" of SimplePortal. ;P

I know, I know, I was already doing that eheh :P
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline MUSTAFAINE

  • Semi Newbie
  • *
  • Posts: 16
  • Gender: Male
    • Metal Up Your ASS!!!
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #10 on: May 07, 2009, 04:43:02 AM »
why it isnt worked at mine site are we include the codes in php area


Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #11 on: May 07, 2009, 07:23:34 AM »
Hello MUSTAFAINE,

It isn't working because you are using SMF 1.1.8 and this is ONLY for SMF 2.0 ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline MUSTAFAINE

  • Semi Newbie
  • *
  • Posts: 16
  • Gender: Male
    • Metal Up Your ASS!!!
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #12 on: May 07, 2009, 10:32:09 AM »
you right blue, i just want to ask the all mods for 2.0 or not.

i couldn`t see any comment but i am new here I ll learn the site thanks..


Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #13 on: May 07, 2009, 11:00:58 PM »
The blocks made by me are for SMF 2.0

I've updated them with a warning telling it's only for SMF 2 ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline CrossFaith

  • Semi Newbie
  • *
  • Posts: 9
  • Gender: Male
    • CrossFaith
  • SMF Version: 1.1.9
  • SP Version: 2.2.2
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #14 on: June 22, 2009, 09:08:40 PM »
Blue can you code one for 1.1.9 please ^^
Visit My Forum ^^ www.crossfaith.net
Powered By Smf 1.1.9 & SimplePortal 2.2.2

Offline primetime

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2 RC1
  • SP Version: 2.2.2
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #15 on: July 10, 2009, 08:36:58 PM »
If I wanted to exclude certain groups, how would I code that in?

Thank you,
Prime

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #16 on: July 10, 2009, 09:04:39 PM »
It would require some
Blue can you code one for 1.1.9 please ^^

Sorry, it's only available for SMF 2.0

If I wanted to exclude certain groups, how would I code that in?

Thank you,
Prime

The only solution I know is that would require to call the table of the members of the database and then put the code in an IF.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Oskarlover

  • Semi Newbie
  • *
  • Posts: 5
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #17 on: April 16, 2010, 02:58:10 AM »
Any way to make it show the user colors?

Like the Admin: Red
Mods: Green

Offline Pervert

  • Just Registered
  • Posts: 1
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #18 on: October 30, 2010, 11:24:29 AM »
Can anyone add the code for Top Arcade Players as well?

Offline shuban

  • Just Registered
  • Posts: 1
  • SMF Version: None
  • SP Version: None
Re: TOP - Posts, Karmas and Money (SMF Shop)
« Reply #19 on: January 31, 2011, 11:34:03 AM »
Can someone please help me adapt the highest karma code to 1.1.12?

Code: [Select]
// TOP KARMAS [CODE]
global $smcFunc, $scripturl, $memberContext;

$members_result = $smcFunc['db_query']('', '
   SELECT id_member, real_name, karma_good
   FROM {db_prefix}members
   ORDER BY karma_good DESC
   LIMIT 3');
$members = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
   $members[] = array(
      'name' => $row_members['real_name'],
      'id' => $row_members['id_member'],
      'karma' => $row_members['karma_good'],
      'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
   );
}
$smcFunc['db_free_result']($members_result);

if (empty($members))
   return;

foreach ($members as $karma)
   echo '
   <table>
   <tr>
      <td style="width: 55px; text-align: center;">', !empty($memberContext[$karma['id']]['avatar']['href']) ? '
         <img src="' . $memberContext[$karma['id']]['avatar']['href'] . '" alt="' . $karma['name'] . '" width="30" height="27" />' : '', '
      </td>
      <td>
         ', $karma['link'], '<br />
          <span class="smalltext">
            <strong>Karmas:</strong> ', $karma['karma'], '
          </span>
      </td>
   </tr>';
   
echo '
</table>';

I wanted to adapt it into the SSI.php file and give it a ssi_NAME. Here's what I did:

Code: [Select]
// TOP KARMAS [CODE]

function ssi_topKARMA($topNumber = 1, $num_posts, $output_method

= 'echo')
{

global $smcFunc, $scripturl, $memberContext;

$members_result = $smcFunc['db_query']('', '
   SELECT id_member, real_name, karma_good
   FROM {db_prefix}members
   ORDER BY karma_good DESC
   LIMIT 3');
$members = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
   $members[] = array(
      'name' => $row_members['real_name'],
      'id' => $row_members['id_member'],
      'karma' => $row_members['karma_good'],
      'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
   );
}
$smcFunc['db_free_result']($members_result);

if (empty($members))
   return;

foreach ($members as $karma)
   echo '
   <table>
   <tr>
      <td style="width: 55px; text-align: center;">', !empty($memberContext[$karma['id']]['avatar']['href']) ? '
         <img src="' . $memberContext[$karma['id']]['avatar']['href'] . '" alt="' . $karma['name'] . '" width="30" height="27" />' : '', '
      </td>
      <td>
         ', $karma['link'], '<br />
          <span class="smalltext">
            <strong>Karmas:</strong> ', $karma['karma'], '
          </span>
      </td>
   </tr>';
   
echo '
</table>';

}

When I call the SSI function in index, it gives me some kind of "string" error. Can anyone tell me what I may be doing wrong? Normally, calling SSI functions in the index.template.php works perfectly. By the way, I do not have simple portals installed.

Website: http://biology-forums.com

« Last Edit: January 31, 2011, 11:41:30 AM by shuban »

 

SimplePortal 2.3.7 © 2008-2021, SimplePortal