Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 01-06-2009, 04:08 AM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ghost Shadow View Post
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.
I thought that was all you wanted, I can add amount of posts for you tomorow.

Quote:
Originally Posted by Dismounted View Post
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...
Thanks for the pointers, I was a little rusty since it's been a few months since I wrote any mods. I'll add these changes and repost.
Reply With Quote
  #12  
Old 01-06-2009, 04:23 AM
Ghost Shadow's Avatar
Ghost Shadow Ghost Shadow is offline
 
Join Date: Aug 2005
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.

Thank you.
Reply With Quote
  #13  
Old 01-06-2009, 10:29 AM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ghost Shadow View Post
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.

Thank you.
Code was changed above to reflect changes. It's stored in a html table with 100% width, just hold it in a container/div of the required width. Still call using $Top5. It caches the top posters when a user visits forumhome. It could be optimized a bit by using a cron instead but I'll leave that to you, however it shouldn't be a problem.
Reply With Quote
  #14  
Old 01-06-2009, 02:52 PM
Ghost Shadow's Avatar
Ghost Shadow Ghost Shadow is offline
 
Join Date: Aug 2005
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bellardia,
Works great!!!
One final request please Bellardia; is it possible to have the nick the system color?

It would be nice to only have the number in yellow, and the name in the system color, both are yellow now.

Thank you Bellardia.
Reply With Quote
  #15  
Old 01-06-2009, 03:38 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ghost Shadow View Post
Bellardia,
Works great!!!
One final request please Bellardia; is it possible to have the nick the system color?

It would be nice to only have the number in yellow, and the name in the system color, both are yellow now.

Thank you Bellardia.
Just give me your color codes so I can match it perfectly
Reply With Quote
  #16  
Old 01-06-2009, 04:56 PM
Ghost Shadow's Avatar
Ghost Shadow Ghost Shadow is offline
 
Join Date: Aug 2005
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bellardia View Post
Just give me your color codes so I can match it perfectly
#848484 for the nick
#FFFF00 for the number

Thank you Bellardia!!!!!!!!
Reply With Quote
  #17  
Old 01-06-2009, 07:15 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad to help It allows me to practice and learn some of the vb features better anyways.

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%" style="color:#848484;">'.$GrabTop['username'].'</td><td style="white-space:nowrap; color:#FFFF00">'.$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>
Reply With Quote
  #18  
Old 01-06-2009, 11:12 PM
Ghost Shadow's Avatar
Ghost Shadow Ghost Shadow is offline
 
Join Date: Aug 2005
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Bellardia.....PERFECT!!
Thanks so much, looks GREAT.
Thanks so much for being patient and so helpful!!! :up:
Reply With Quote
  #19  
Old 01-07-2009, 05:37 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Bellardia View Post
Glad to help It allows me to practice and learn some of the vb features better anyways.
What's the point of putting the data into the datastore when you're going to update it every time? You need to add a "time to live" on the variable (e.g. TIMENOW + 10 mins), then check if this time is up, if it is not, don't update the cache, but use the data already in the cache.
Reply With Quote
  #20  
Old 01-07-2009, 05:22 PM
Ghost Shadow's Avatar
Ghost Shadow Ghost Shadow is offline
 
Join Date: Aug 2005
Posts: 66
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
What's the point of putting the data into the datastore when you're going to update it every time? You need to add a "time to live" on the variable (e.g. TIMENOW + 10 mins), then check if this time is up, if it is not, don't update the cache, but use the data already in the cache.
Do I need to change something?
One other thing, not a big deal, but it would be nice if it could be changed.
The first digit is showing up on the left, instead of the right. Please see graphic; zero under one. It would be nice just to have numbers begin on the far right.



Thank you!!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:03 PM.


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.04425 seconds
  • Memory Usage 2,265KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete