vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Top 5 posters (https://vborg.vbsupport.ru/showthread.php?t=200783)

Bellardia 01-07-2009 11:09 PM

Hopefully this will be my final revision :x

Fixed alignment, and updates every 20minutes.
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="top5posters" active="1">
        <title>Top 5 Posters</title>
        <description>Gets a string of the top five posters, and parses where $Top5 is included in a template</description>
        <version>0.1</version>
        <url />
        <versioncheckurl />
        <dependencies>
        </dependencies>
        <codes>
        </codes>
        <templates>
        </templates>
        <plugins>
                <plugin active="1" executionorder="10">
                        <title>Parse Names</title>
                        <hookname>global_start</hookname>
                        <phpcode><![CDATA[global $vbulletin;
        $Top5Data = unserialize($vbulletin->TopPosters);
        if (count($Top5Data) != 2) $Top5Data[0] = 0;
        $Top5 = $Top5Data[1];
        if (($Top5Data[0] + 1200) < TIMENOW)
        {
                $GrabString = $vbulletin->db->query_read("select `username`, `posts` from `".TABLE_PREFIX."user` ORDER BY `posts` DESC limit 0, 4;");
                while ($GrabTop = $vbulletin->db->fetch_array($GrabString))
                {
                        $Top5Store[] = '<tr><td width="100%" style="color:#848484;">'.$GrabTop['username'].'</td><td style="white-space:nowrap; color:#FFFF00" align="right">'.$GrabTop['posts'].'</td></tr>';       
                }
                $Top5Store = '<table width="100%" border="0" style="color:#FF0">'.implode('', $Top5Store).'</table>';
                htmlspecialchars_uni($Top5Store);
                $Top5Storage = array(TIMENOW, $Top5Store);
                build_datastore('TopPosters', serialize($Top5Storage));
                $Top5 = $Top5Store;
        }]]></phpcode>
                </plugin>
                <plugin active="1" executionorder="5">
                        <title>DataStore</title>
                        <hookname>init_startup</hookname>
                        <phpcode><![CDATA[$datastore_fetch[] = "'TopPosters'";
$Top5 = $vbulletin->TopPosters;]]></phpcode>
                </plugin>
        </plugins>
        <phrases>
        </phrases>
        <options>
        </options>
        <helptopics>
        </helptopics>
        <cronentries>
        </cronentries>
        <faqentries>
        </faqentries>
</product>


Ghost Shadow 01-07-2009 11:19 PM

Bellardia, you are a "Coding Saint". Now it is PERFECT!!
Today is my birthday; thank you for all the time you spent helping me, fantastic present.
Peace my friend.


:p:D:):rolleyes::eek::cool:;):up:

Dismounted 01-08-2009 03:14 AM

Quote:

Originally Posted by Bellardia (Post 1704609)
Hopefully this will be my final revision :x

Maybe not. ;)

First line of the plugin at init_startup, you have too many sets of quotes. Second line is not needed at all. When using build_datastore(), you can set a third parameter, which can automatically unserialize the data for you. Also, you want to run htmlspecialchars_uni on the username, not the whole thing. Finally, you might want to look at the vBulletin Coding Standards document.

F0xy 02-06-2009 07:57 PM

it would be amazing if this could be edited to show the top 10 latest posts for the sidebar.

When I added the latest it only displayed the top 4 posters?

slinky 04-27-2009 03:28 PM

I'm using an old hack and need to work on this one. If I had the time I'd probably take a better look. I'm shocked that nobody has done a good one for this very popular function.


All times are GMT. The time now is 07:01 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01176 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete