The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Top 5 posters
Is it possible to list the top 5 posters? Such as using a "$"?
TIA -Joseph |
#2
|
|||
|
|||
You can't call them by any defined function, but you could make a short plugin that uses a single query to find the top 5, and then style them as you want.
|
#3
|
||||
|
||||
How difficult is this to do Bellardia?
|
#4
|
|||
|
|||
Depends how much of the information you want to be displayed and how you want it to be styled, simply listing the top 5 posters in commas in plain text would be very simple; a few lines of code.
Styling them wouldn't be much harder either if using basic styles. However pulling other information with them would take joins (say, color of username, usertitle etc) but nonetheless quite simple in essence. Depending on what your needs are I could write up a quick script for you. |
#5
|
||||
|
||||
Quote:
I created a sidebar and I want it to go within "Top 5 Posters" block, 3rd from the top. I just want the nick of the poster on the far left, and number of posts on the far right. With the highest poster on top, to the lowest on bottom. If possible, making the numbers yellow and keeping the names default. I'll open the forum so you can see the side block I'm referring to. Thank you so much for your kindness! -Joseph http://www.warfaith.com/ |
#6
|
|||
|
|||
I have class now, so just give me 3-4 hours ;p
|
#7
|
||||
|
||||
KoOL
I'll close the forum back up...Thank you!!!!! |
#8
|
|||
|
|||
Open a plaintext editor, paste in the code below, and save it as something. Upload it as a product.
Where you want the names to appear, place '$Top5' in the template, and they will be inserted in yellow color. You can specify your own color of yellow by finding and replacing '#ff0' with any hex color of your choice. I just used the default yellow because I don't know what you're after Please don't repost, submit, or distribute without asking! Feel free to use as you need. 1 Query, 0 File edits, 0 Uploads 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="5"> <title>Top5Posters</title> <hookname>forumhome_start</hookname> <phpcode><![CDATA[global $vbulletin; $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%">'.$GrabTop['username'].'</td><td style="white-space:nowrap">'.$GrabTop['posts'].'</td></tr>'; } $Top5Store = '<table width="100%" border="0" style="color:#FF0">'.implode('', $Top5Store).'</table>'; htmlspecialchars_uni($Top5Store); build_datastore('TopPosters', $Top5Store); unset($GrabTop, $Top5Store, $GrabString);]]></phpcode> </plugin> <plugin active="1" executionorder="10"> <title>Parse Names</title> <hookname>global_start</hookname> <phpcode><![CDATA[$Top5 = $vbulletin->TopPosters;]]></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> |
#9
|
||||
|
||||
First, thank you for the time you spent on writing this code.
It partially works. Does not show the number of posts. Just shows users in sequence separated by a comma. |
#10
|
||||
|
||||
1) You do not need to evaluate that code...
2) And therefore, do not need addslashes(). 3) You should run htmlspecialchars_uni() on the username. 4) This is the sort of data that the datastore should cache. No one cares if the data is 10 minutes off or so... |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|