Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2002, 09:24 PM
esawdust esawdust is offline
 
Join Date: Dec 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding Referral Count to User Stats

Hi folks,

How would I go about adding "Referrals:" to the user stats at left (locatin, registered since, and posts, etc..)

I have installed the Refer Friends hack and want to add the # of referrals to this info. Also is there a variable ($referrals ??) that would present the users total referrals within the user stats on every post.

Thanks for any help.

Greg
Reply With Quote
  #2  
Old 11-10-2002, 03:15 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not tested myself, but should work - try this:

In functions.php, find:

PHP Code:
    $post[off]=bbcodeparse($post[off],0,$allowsmilies); 
UNDERNEATH, add:

PHP Code:
  // Get referrals
  
if ($usereferrer) {
    
$refcount $DB_site->query_first("SELECT count(*) AS count
                                       FROM user
                                       WHERE referrerid = '
$post[userid]'");
    
$referrals $refcount[count];

Then, in your postbit, add this anywhere you like to show the referral count:

Code:
Referrals: #$referrals
Should work! However, this will add an extra query per post in a thread to the showthread page. There's no real way around this unfortunately, since the referral count needs a query to COUNT the variable from the database.
Reply With Quote
  #3  
Old 11-10-2002, 03:15 PM
esawdust esawdust is offline
 
Join Date: Dec 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your reply Erwin!

I looked and looked for the snippet of code (an probably missed it :cross-eyed: ) to no avail.. (functions.php in VB 2.2.8)

Can you give me an idea where it may be? I did post the code on the 248-255 but it didn't work.

I have the postbit taken care of.

Here's my code:

Quote:
$post[useremail]="";
$post[icqicon]="";
$post[aimicon]="";
$post[yahooicon]="";
$post[homepage]="";
$post[findposts]="";
$post[signature]="";
$onlinestatus="";
}
// Get referrals
if ($userreferrer) {
$refcount = $DB_site->query_first("SELECT count(*) AS count
FROM user
WHERE referrerid = '$post[userid]'");
$referrals = $refcount[count];
}

// do ip addresses
if ($post[ip]!="") {
if ($logip==2) {
Seeing as how the user profile pulls the referrals already (assuming it's activated in vB) is there a $string already set that could be placed in the postbit? Or is that all done through a query also?

Thanks a bunch!

Greg
Reply With Quote
  #4  
Old 11-10-2002, 11:05 PM
esawdust esawdust is offline
 
Join Date: Dec 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #5  
Old 11-10-2002, 11:10 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Put the code in functions.php exactly where I say to put it - that line of code was taken from functions.php 2.2.8 unhacked - and then remember to edit your postbit template. It should work.

The referral count needs to be specifically queried from the database for the postbit.
Reply With Quote
  #6  
Old 11-10-2002, 11:59 PM
esawdust esawdust is offline
 
Join Date: Dec 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay... I still cannot find that "exact" line of code. I even performed a find and replace in Dreamweaver after manually scrolling 2300 plus lines and it wasn't found. Then I pulled a fresh vb.zip for the functions.php file (figuring maybe a hack modified it) and still no match.

Either I'm nuts, blind, or that code is not in there There is no code that starts with $post[off] whatsoever in the functions.php version 2.2.8.

Please advise?!?

Thanks for your time,

Greg
Reply With Quote
  #7  
Old 11-11-2002, 12:23 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, vB.org parsed the code I used.

Try to find this in functions.php instead:

PHP Code:
        eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";"); 
Add my code ABOVE this.

See if that works.
Reply With Quote
  #8  
Old 11-11-2002, 04:53 PM
esawdust esawdust is offline
 
Join Date: Dec 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay.. found the code but it didn't work The Referrals: # shows up in my postbit but it's not logging the $referrals number.



Code:
		} else {
			$post[pmlink] = "";
		}
// Get referrals
  if ($usereferrer) {
    $refcount = $DB_site->query_first("SELECT count(*) AS count
                                       FROM user
                                       WHERE referrerid = '$post[userid]'");
    $referrals = $refcount[count];
}
		eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";");
		eval("\$post[search] = \"".gettemplate("postbit_search")."\";");
		eval("\$post[buddy] = \"".gettemplate("postbit_buddy")."\";");
Code:
<smallfont>Registered: $post[joindate]<br>
	Location: $post[field3]<br>
	Posts: $post[posts]<br>
                Total Referrals:#$referrals<br><br>
                Certifications: <br>$badge $badge2 $badge3<br>
                $onlinestatus</smallfont></td>	
	<td bgcolor="$post[backcolor]" width="100%"
Reply With Quote
  #9  
Old 11-11-2002, 05:01 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this code instead:

PHP Code:
// Get referrals
   
$refcount $DB_site->query_first("SELECT count(*) AS count FROM user WHERE referrerid = '$post[userid]'"); 
Put that where you tried the other code.

Then, in your postbit template, try this:

Code:
Referrals: #$refcount[count]
Reply With Quote
  #10  
Old 11-11-2002, 05:09 PM
esawdust esawdust is offline
 
Join Date: Dec 2001
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Erwin,

I made the changes... now when I click on a thread it gives me:

Quote:
Fatal error: Call to a member function on a non-object in /public_html/forums/admin/functions.php on line 228
Thanks again.
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:01 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.04689 seconds
  • Memory Usage 2,264KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_code
  • (4)bbcode_php
  • (2)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
  • (1)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_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