Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Display top referrer on forum index Details »»
Display top referrer on forum index
Mod Version: 1.00, by Chen (Coder) Chen is offline
Developer Last Online: Mar 2009 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 2.2.x Rating: (0 vote - 0 average) Installs: 12
Released: 12 Aug 2001 Last Update: Never Downloads: 0
Not Supported  

This was requested by PeterNRG and actually hacked by Freddie (but it's my thread ).

1. In index.php find

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and above it add

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Comments
  #2  
Old 12 Aug 2001, 09:15
buro9 buro9 is offline
 
Join Date: Feb 2002
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
Reply With Quote
  #3  
Old 12 Aug 2001, 09:29
Chen's Avatar
Chen Chen is offline
 
Join Date: Sep 2001
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
Reply With Quote
  #4  
Old 12 Aug 2001, 12:47
SirSteve SirSteve is offline
 
Join Date: Oct 2001
?

Can you elaborate on this?

3. Add an index to field referrerid in table user.
Reply With Quote
  #5  
Old 12 Aug 2001, 13:36
Chen's Avatar
Chen Chen is offline
 
Join Date: Sep 2001
Take a look here.
__________________
Chen Avinadav
Formerly vBulletin.org Owner and Founder

chen@avinadav.com
Reply With Quote
  #6  
Old 12 Aug 2001, 15:02
Freddie Bingham's Avatar
Freddie Bingham Freddie Bingham is offline
 
Join Date: Oct 2001
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:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #7  
Old 12 Aug 2001, 15:59
Freddie Bingham's Avatar
Freddie Bingham Freddie Bingham is offline
 
Join Date: Oct 2001

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #8  
Old 12 Aug 2001, 16:03
Chen's Avatar
Chen Chen is offline
 
Join Date: Sep 2001
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
Reply With Quote
  #9  
Old 12 Aug 2001, 17:04
PeterNRG PeterNRG is offline
 
Join Date: Mar 2002
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!
__________________
www.ultrashock.com - www.nrg.be
Reply With Quote
  #10  
Old 12 Aug 2001, 20:55
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
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)
Reply With Quote
  #11  
Old 12 Aug 2001, 20:57
Freddie Bingham's Avatar
Freddie Bingham Freddie Bingham is offline
 
Join Date: Oct 2001
This will exclude users with userid 1, 5 and 7. Note the portion in bold that you would want to change.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Reply With Quote
  #12  
Old 12 Aug 2001, 21:06
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
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)
Reply With Quote
  #13  
Old 13 Aug 2001, 00:43
SirSteve SirSteve is offline
 
Join Date: Oct 2001
I agree...

I agree with Peter... let's start over with fresh install instructions.
Reply With Quote
  #14  
Old 13 Aug 2001, 05:40
Chen's Avatar
Chen Chen is offline
 
Join Date: Sep 2001
Done. Thanks a lot Freddie!
__________________
Chen Avinadav
Formerly vBulletin.org Owner and Founder

chen@avinadav.com
Reply With Quote
  #15  
Old 13 Jan 2002, 18:48
Lucky Lucky is offline
 
Join Date: Dec 2001
Great work.

Thank you!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 20:30.

Layout Options | Width: Wide Color: