vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Display top referrer on forum index (https://vborg.vbsupport.ru/showthread.php?t=25170)

Freddie Bingham 08-12-2001 07:57 PM

This will exclude users with userid 1, 5 and 7. Note the portion in bold that you would want to change.
Code:

// get top referrer
if ($usereferrer) {
  $ref = $DB_site->query_first("SELECT COUNT(*) AS referrals, user.username, user.userid FROM user AS users
                  LEFT JOIN user ON (users.referrerid = user.userid)
                  WHERE users.referrerid <> 0 AND
                  user.userid NOT IN (1,5,7)
                  GROUP BY users.referrerid
                  ORDER BY referrals DESC
                  LIMIT 1");

  eval("\$topreferrer = \"".gettemplate('topref')."\";");
}

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.

Bane 08-12-2001 08:06 PM

Thanks Freddie and Firefly :) These are great additions!

SirSteve 08-12-2001 11:43 PM

I agree with Peter... let's start over with fresh install instructions.

Admin 08-13-2001 04:40 AM

Done. Thanks a lot Freddie! :)

Lucky 01-13-2002 05:48 PM

Great work.

Thank you!

Lucky 02-08-2002 02:07 PM

Works with 2.2.2

Thanks again

eg_92901 02-08-2002 11:44 PM

I just tried installing and get nothing on my forum homepage.
I added it to the forumhome template and this shows up:
Top Referrer: with referrals

But no member or # of referrals. ???

I've checked myself several time and everything looks right.
I made the change to index.php
Added the topref template
Added $topreferrer to my forumhome template.

???

Lucky 02-09-2002 09:01 AM

Quote:

Originally posted by freddie
Code:

// get top referrer
if ($usereferrer) {
  $ref = $DB_site->query_first("SELECT COUNT(*) AS referrals, user.username, user.userid FROM user AS users
                  LEFT JOIN user ON (users.referrerid = user.userid)
                  WHERE users.referrerid <> 0
                  GROUP BY users.referrerid
                  ORDER BY referrals DESC
                  LIMIT 1");

  eval("\$topreferrer = \"".gettemplate('topref')."\";");
}

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.

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.

You must do the above for it to work

MrBojangle1 05-05-2002 02:26 AM

OK i am very confused on what to do can someone put all the RIGHT steps on a txt file and send to me through PM or on AIM at SSJ4Gohan354

Webmasta XT 07-20-2002 08:25 PM

I applied the hack, and all I get is Nothing, nothing at all on forumhome, I did whatever freddie said..


All times are GMT. The time now is 07:40 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.02842 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete