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 full list of referrers and referrals (https://vborg.vbsupport.ru/showthread.php?t=25173)

Joshs 09-02-2001 04:41 AM

What should my templates look like to make this work?

Joshs 09-03-2001 12:55 AM

bump

hondastyle 09-03-2001 02:41 AM

Great hack! Should generate some incentive for users to start doing some referring.

Thanks very much...It was an easy install and a very nice addition to my boards.

dwh 09-03-2001 05:06 AM

Well, this is how I have it though I don't have that stuff on top about the top referrer, though it should be easy enough to add in the code.

First towards the top of the reflist template I took your javascript
PHP Code:

<script>
<!--
function 
jumpPage(newLoc) {
    
newPage newLoc.options[newLoc.selectedIndex].value
    
if (newPage != "") { window.location.href newPage }
}
// -->
</script

then you have your navbar etc then here's the table row

PHP Code:

<tr align="center">
  <
td bgcolor="#8080A6" align="center"><smallfont color="#EEEEFF"><b>Member</b></smallfont></td>
  <
td bgcolor="#8080A6" align="center"><smallfont color="#EEEEFF"><b>Referrals</b></smallfont></td>
  <
td bgcolor="#8080A6" align="center"><smallfont color="#EEEEFF"><b>Members Referred</b></smallfont></td>
</
tr>
$reflistbits 

Then in the reflistbits template I've got:

PHP Code:

<tr align="center">
    <
td bgcolor="#F1F1F1"><smallfont><b><a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$referrer[userid]">$referrer[username]</a></b></smallfont></td>
    <
td bgcolor="#DFDFDF"><smallfont>$referrer[referrals]</smallfont></td>
    <
form><td bgcolor="#F1F1F1"><smallfont>$referrerlist</smallfont></td></form>
</
tr

hope that helps.

dwh 09-03-2001 05:10 AM

I think I just found a bug in vb. Notice that my vbcode for php is correct (i think)
yet when you use 3 php's the /php code doesn't seem to work....and it indents and puts funny colors.

Joshs 09-03-2001 03:03 PM

<a href="http://24.45.176.213:81/forums/referrerlist.php?s=" target="_blank">http://24.45.176.213:81/forums/referrerlist.php?s=</a>

Pretty perfect... but there is an extra row at the end... any ideas as how to fix that?

dwh 09-03-2001 06:39 PM

I guess you modified my code to get the top referrer, post your templates and code changes..I do not have that problem.

Joshs 09-03-2001 08:33 PM

referrerlist.php:
PHP Code:

<?php
error_reporting
(7);
$templatesused='referrer_listbit,referrer_list,referrer_top';
require(
'./global.php');

// Top Referrer List Hack  ############################################
//    Hacked by: FireFly with help from dwh,unixman,Freddie,Bane
// Config  #######################################################

$max=100;        //This number decides how many users to display
$userx=0;        //Users to exclude from top referrer            Seperate with ,    (0 for none)
$userl=0;            //Users to exclude from top referrer list        Seperate with ,    (0 for none)

// Get Top List  ###################################################
$referrers $DB_site->query("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 (
$userl)
                   GROUP BY users.referrerid
                   ORDER BY referrals DESC
                   LIMIT 
$max");
while (
$referrer=$DB_site->fetch_array($referrers)) {
    
$referreds $DB_site->query("SELECT username,userid FROM user WHERE referrerid = '$referrer[userid]'");
    
$referrerlist "<SELECT NAME='newLoc' onChange='jumpPage(this.form.newLoc)' style='font-size: 7pt; background-color: #dfdfdf; font-family: Arial, Tahoma;' maxlength='25'><OPTION VALUE='#'>------------Select------------</OPTION>";
    while (
$referred $DB_site->fetch_array($referreds)){
        if (
$referrerlist) {
            
$referrerlist.="<OPTION VALUE='member.php?s=$session[sessionhash]&action=getinfo&userid=$referred[userid]'>$referred[username]</OPTION>";
        }
    }
    
$referrerlist.="</select>";
    eval(
"\$reflistbits .= \"".gettemplate("referrer_listbit")."\";");
    
$referrerlist="";
}

// 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 (
$userx)
                   GROUP BY users.referrerid
                   ORDER BY referrals DESC
                   LIMIT 1"
);

  eval(
"\$topreferrer = \"".gettemplate('referrer_top')."\";");
}
    
    eval(
"\$reflistbits .= \"".gettemplate("referrer_listbit")."\";");
    
$referrerlist="";

// ############################################################
makeforumjump();
eval(
"dooutput(\"".gettemplate("referrer_list")."\");");
?>

referrer_list:
PHP Code:

{htmldoctype}
<
HTML>
<
HEAD><TITLE>$bbtitle Top Referrer List</title>
$headinclude
</head>
<
body>
$header
<!-- breadcrumb -->
<
table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>
<
td width="100%"><img src="{imagesfolder}/vb_bullet.gif" align="absmiddle"> <normalfont><b><a href="index.php?s=$session[sessionhash]">$bbtitle</a> &gtTop Referrers</b></normalfont></TD></tr></table>
<!-- /
breadcrumb -->

<!--
Begin-->
<
br>

<
table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextrawidth="{contenttablewidth}" align="center"><tr><td>
<
table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextrawidth="100%">
<
tr align="center">
    <
td bgcolor="{secondaltcolor}"><smallfont><a href="memberlist.php?s=$session[sessionhash]&action=search"><b>Advanced Search</b></a></smallfont></td>
    <
td bgcolor="{secondaltcolor}"><smallfont><a href="memberlist.php?s=$session[sessionhash]&what=topposters&perpage=$memberlisttopposters"><b>Top $memberlisttopposters Posters</b></a></smallfont></td>
    <
td bgcolor="{secondaltcolor}"><smallfont><a href="memberlist.php?s=$session[sessionhash]"><b>List Alphabetically</b></a></smallfont></td>
    <
td bgcolor="{secondaltcolor}"><smallfont><a href="memberlist.php?s=$session[sessionhash]&what=datejoined"><b>List by Date Joined</b></a></smallfont></td>
<!-- 
Begin Referrals -->
<
td bgcolor="{firstaltcolor}"><smallfont><a href="referrerlist.php?s=$session[sessionhash]"><b>Referrals</b></a></smallfont></td>
<!-- 
End Referrals -->
<!-- 
Begin Forum Leaders -->
<
td bgcolor="{secondaltcolor}"><smallfont><a href="showmods.php?s=$session[sessionhash]"><b>Forum Leaders</b></a></smallfont></td>
<!-- 
End Forum Leaders -->
</
tr>
</
table>
</
td></tr></table>

<
br>
<!--
End-->

<!-- 
main -->
<!--
<
table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" {tableouterextrawidth="250" align="center"><tr>
    <
td><div align="center">$topreferrer</div></td>
</
tr></table>
-->
<
p align="center">$topreferrer</p>
<
table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextrawidth="275" align="center"><tr><td>
<
table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextrawidth="275">
<
tr align="center">
  <
td bgcolor="{tableheadbgcolor}" align="center" width="100"><smallfont color="{tableheadtextcolor}"><b>Member</b></smallfont></td>
  <
td bgcolor="{tableheadbgcolor}" align="center" width="50"><smallfont color="{tableheadtextcolor}"><b>Referrals</b></smallfont></td>
  <
td bgcolor="{tableheadbgcolor}" align="center" width="125"><smallfont color="{tableheadtextcolor}"><b>Members Referred</b></smallfont></td>
</
tr>
$reflistbits
</table>
</
td></tr></table>

<
p align="center">$forumjump</p>

<!-- /
main -->
$footer
</body></html

referrer_listbit:
PHP Code:

<tr align="center">
    <
td bgcolor="{firstaltcolor}"><smallfont><b><a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$referrer[userid]">$referrer[username]</a></b></smallfont></td>
    <
td bgcolor="{firstaltcolor}"><smallfont>$referrer[referrals]</smallfont></td>
    <
form><td bgcolor="{firstaltcolor}">$referrerlist</td></form>
</
tr


dwh 09-03-2001 09:46 PM

Do you have phpMyAdmin? Or have any other way to do an sql command? It may be an issue with the data in the database. If you can do an sql call run this query:
PHP Code:

SELECT COUNT(*) AS referralsuser.usernameuser.userid FROM user AS users
                   LEFT JOIN user ON 
(users.referrerid user.userid)
                   
WHERE users.referrerid <> AND
                   
user.userid NOT IN (0)
                   
GROUP BY users.referrerid
                   ORDER BY referrals DESC
                   LIMIT 100 

I wouldn't be surprised if you get some weird result, but either way, post results here and we'll take it from there.

BTW, I really like your site design. You have a good eye for design.

Joshs 09-03-2001 09:50 PM

PHP Code:

SELECT COUNT(*) AS referralsuser.usernameuser.userid FROM user AS users
                   LEFT JOIN user ON 
(users.referrerid user.userid)
                   
WHERE users.referrerid <> AND
                   
user.userid NOT IN (0)
                   
GROUP BY users.referrerid
                   ORDER BY referrals DESC 

Looked like it worked right...


All times are GMT. The time now is 10:36 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.01272 seconds
  • Memory Usage 1,841KB
  • 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
  • (8)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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