vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Adding Referral Count to User Stats (https://vborg.vbsupport.ru/showthread.php?t=45557)

esawdust 11-09-2002 09:24 PM

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

Erwin 11-10-2002 03:15 AM

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. :)

esawdust 11-10-2002 03:15 PM

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

esawdust 11-10-2002 11:05 PM

bump

Erwin 11-10-2002 11:10 PM

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.

esawdust 11-10-2002 11:59 PM

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

Erwin 11-11-2002 12:23 AM

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.

esawdust 11-11-2002 04:53 PM

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%"


Erwin 11-11-2002 05:01 PM

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]

esawdust 11-11-2002 05:09 PM

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.


All times are GMT. The time now is 01:41 AM.

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.01130 seconds
  • Memory Usage 1,752KB
  • 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
  • (4)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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