![]() |
This was requested by PeterNRG and actually hacked by Freddie (but it's my thread :p).
1. In index.php find PHP Code:
PHP Code:
For example: Code:
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 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! :) |
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 |
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. ;) |
Can you elaborate on this?
3. Add an index to field referrerid in table user. |
Take a look here. :)
|
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: Code:
SELECT COUNT(*) AS count, user.username, user.userid FROM user AS users 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. |
Code:
// get top referrer |
Heh, I know you weren't. :)
But I'm new with this, so it's ok to mess up sometimes, eh? ;) |
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! :cool: |
Is there a way to exclude a user from this list? For example, the admin?
|
All times are GMT. The time now is 04:17 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|