![]() |
|
|
Mod Options |
Display top referrer on forum index Details »»
|
|||||||||||||||||||||||
|
Display top referrer on forum index
Developer Last Online: Mar 2009
This modification is in the archives.
This was requested by PeterNRG and actually hacked by Freddie (but it's my thread
).1. In index.php find
and above it add
2. Create a new template called topref. In this template, you can use $ref[referrals] (number of referrals), $ref[username] (for the top referrar's username) and $ref[userid] (for top referrar's user ID). For example:
3. Add an index to field referrerid in table user. 4. Place $topreferrer wherever you want the topref template to be displayed. That's it. Demo can be found here. Good luck, and thank freddie! ![]() Download Now Only licensed members can download files, Click Here for more information. Show Your Support
No members have liked this post.
|
|||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
i just applied this hack, as it's something i want on my board, but doing so caused the page to timeout and about 80 e-mails similiar to
Database error in vBulletin: Invalid SQL: SELECT count(*) AS count FROM user WHERE referrerid = '350' mysql error: Lost connection to MySQL server during query mysql error number: 2013 Date: Sunday 12th of August 2001 01:11:17 PM Script: /forum/index.php?s= Referer: to drop into my inbox. could you advise whether this a problem with the query (inefficient or no indexes on the correct columns) or whether this is more a problem that you've tested this on a site with low qty of users and haven't been able to find out what would happen on a site with 1000+ members. i would like the hack, but not at the expense of the homepage ![]() cheers david k No members have liked this post.
|
|
#3
|
||||
|
||||
|
Sorry, I forgot to mention that a new index is needed (I added it about a week ago, not related to this hack at all). Sorry.
![]() I updated the first post. Also, please re-do step 2, as I forgot a = there. ![]()
__________________
Chen Avinadav Formerly vBulletin.org Owner and Founder chen@avinadav.com No members have liked this post.
|
|
#4
|
|||
|
|||
|
?
Can you elaborate on this?
3. Add an index to field referrerid in table user. No members have liked this post.
|
|
#5
|
||||
|
||||
|
Take a look here.
![]()
__________________
Chen Avinadav Formerly vBulletin.org Owner and Founder chen@avinadav.com No members have liked this post.
|
|
#6
|
||||
|
||||
|
You do not want to loop through every user and count their referrers! If you have 10,000 users, that would be 10,000 queries!
Why don't you work this into your hack instead:
Referrals are done the way it is so that you can figure out what users a person has referred. Also your code would appear to not work as you intended it to. You are trying to loop through all of the users and are using numbermembers but that will not work for people with > 999 users as it will have commas added to it. You should use $numbersmembers[user] if you really want to do that. Your code took 40 seconds to execute on my site. My suggestion took .03 seconds. No members have liked this post.
|
||||
|
#7
|
||||
|
||||
I wasn't trying to make you look bad. You can not loop through the entire user table querying each user. That would be a very bad thing (tm) to do. The timeout problems the above poster had were because of that. No members have liked this post.
|
||||
|
#8
|
||||
|
||||
|
Heh, I know you weren't.
![]() But I'm new with this, so it's ok to mess up sometimes, eh? ![]()
__________________
Chen Avinadav Formerly vBulletin.org Owner and Founder chen@avinadav.com No members have liked this post.
|
|
#9
|
|||
|
|||
|
Can we start over and put up the right code & explanations?
FireFly: I don't see #4 working on your board... vB developers: get this hack optimized and included in the next vB version! ![]() No members have liked this post.
|
|
#10
|
||||
|
||||
|
Is there a way to exclude a user from this list? For example, the admin?
__________________
Bane ° talkloud Network - Forums never smelled this good. ° el coolo hacko - vbStats vBORG Chat - Hang with the price of poop flinging *monkey sound* (irc.devcore.co.uk port 6667 - channel: #vBorg) No members have liked this post.
|
|
#11
|
||||
|
||||
|
This will exclude users with userid 1, 5 and 7. Note the portion in bold that you would want to change.
And template: Top referrer of this forum: <b><a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$ref[userid]">$ref[username]</a></b> with <b>$ref[referrals]</b> referrals. No members have liked this post.
|
||||
|
#12
|
||||
|
||||
|
Thanks Freddie and Firefly
These are great additions!
__________________
Bane ° talkloud Network - Forums never smelled this good. ° el coolo hacko - vbStats vBORG Chat - Hang with the price of poop flinging *monkey sound* (irc.devcore.co.uk port 6667 - channel: #vBorg) No members have liked this post.
|
|
#13
|
|||
|
|||
|
I agree...
I agree with Peter... let's start over with fresh install instructions.
No members have liked this post.
|
|
#14
|
||||
|
||||
|
Done. Thanks a lot Freddie!
![]()
__________________
Chen Avinadav Formerly vBulletin.org Owner and Founder chen@avinadav.com No members have liked this post.
|
![]() |
«
Previous Mod
|
Next Mod
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
| Mod Options | |
|
|
| New To Site? | Need Help? |
All times are GMT. The time now is 00:53.



).




