Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Admin (Coder) Admin is offline
Developer Last Online: Nov 2024 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 08-11-2001 Last Update: Never Installs: 8
 
No support by the author.

To see this in action go here.

Installation:
0. Download the attached zip file and extract it.
1. Create a new file named referrerlist.php and in it put the content of referrerlist.txt in it. Config $shownorefs.
2. Create a new template named reflist and put the content of reflist.txt in it.
3. Create a new template named reflistbit and put the content of reflistbit.txt in it.
4. Add an index to the field referredid in the table user.
5. Add a link to referrerlist.php?s=$session[sessionhash] anywhere you want.

Good luck, and feedback is welcomed!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 08-24-2001, 07:43 AM
george_proost george_proost is offline
 
Join Date: Nov 2001
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yip, I agree eva2000.

I am looking for an exciting new alternative which is
'perpetually inclusive', I believe a member should get some credit
for even great-great-..-grand-referals.

I would like to offer prizes every 3 months.
At the start of a given period all RIP totals are 0.

If a referer joins from a related referred member ALL those in the
chain of referral benefit. The referral tree will eventually also be displayed for the period.

So even 1 referal starts it off and puts all members that have
residual RIP's on the prize list already.
Reply With Quote
  #23  
Old 08-24-2001, 08:44 AM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I seee...hmm. This isn't too easy in my view and may add significant load on the server. I won't do it for you but I'll give you some direction as to how I'd do it if I was really set on it.

I don't believe you can do this with one sql statement based on the current table layout. But if you add some fields perhaps it can be done. Very complicated though. There may be some code somewhere to handle this. Look in the IPAddress code of vb. The problem is you need to do recursive searching. Or try I think it's php.net for some code.

Personally I think it's way more trouble than it's worth....if you can accept .5 instead of .5 then .25 etc it will be a little bit easier with a new field, but still a royal pain.
Reply With Quote
  #24  
Old 08-31-2001, 06:07 AM
futureal futureal is offline
 
Join Date: Feb 2002
Location: Del Mar, CA, USA
Posts: 556
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been trying to play around with this referrer stuff myself, and was wondering:

How difficult would it be to add a user field to the table that keeps track of a user's # of referrals, in addition to keeping track of "who referred who" like it does now?

I would like to be able to add a "Referrals" column to, for example, the Member Listing, without having to loop through the list for each user to see who referred who. Also, I would like to be able to sort the Member Listing based on # of referrals, which I have not been able to do so far (without an absolutely ludicrous amount of database queries). My goal in this regard is strictly numeric; the system already keeps track of who referred who, so all I am looking for a single numeric field that is incremented, say, when somebody registers.

I know you can add fields using the ALTER command though I know very little about it and don't want to screw anything up. It does seem that once a field like that was added, putting the rest together would be very easy.

Am I wrong, or would this be a relatively easy hack?
Reply With Quote
  #25  
Old 08-31-2001, 06:26 AM
george_proost george_proost is offline
 
Join Date: Nov 2001
Posts: 69
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm busy on a basic spec. It is not too difficult.
This is NOT a program but a way of specing a program.
Ideally it would become php and integrate passively with
vBulletin.

I am not a programmer so it could take yonks to do this.
A pro-programmer could probably do this in 3-4 hours.

It is NOT a hack as NO vBulletin code would be changed,
no new or altered tables nor new columns in tables.

Code:
// userrips.php
//
// the intention of this program is to calculate the number
// of Referral Index Points or RIPs for short.
//    =====================  
// 
// A RIP allows for the correct allocation of credit when even an  n'th
// generation registration occurs. If the referrer is an ancestor of yours you
// still get credit for registration between date ranges
//
// This task needs to run periodically to keep track of things. (cronjob)
// it will probably be too greedy to run 'real-time'.
// 
// the process described trickles RIP credits to all members 
// for new member registrations within any given period of time  

input parameters from_date, to_date

delete table userrips if it exists

create table userrips columns userid referrerid dateregistered rips 

select userid, referrerid, dateregistered from user descending 
// user table is no longer used in this program
// it will be queried again when the display needs to be shown
// the display can be a modified clone the current refertally program

insert userid, referrerid, dateregistered rips=0 into userrips

// table userrips will now be acted upon by two separate loops
// loop_1 just keeps the current user being analysed and is looped through
// processing only those users with a referrerid. This is a simple step_process loop.


foreach ( referrerid <> 0 AND dateregistered falls within date rangeparms ) //loop1
   // set up start variables for each itteration of user
   points = 1
   luckyuserid = reffererid      
   // now trickle deminishing credit down the table    
   do while luckyuserid <> 0       
      udpate userrips rips with rips+points where userid = luckyuserid
      select referrerid as luckyuserid from userrips userid = luckyuserid 
      points = points / 2
   enddo 
endfor

// end spec
Reply With Quote
  #26  
Old 09-01-2001, 07:24 PM
Joshs Joshs is offline
 
Join Date: Oct 2001
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Check this out: http://24.45.176.213:81/forums/referrerlist.php?s=

I have a question, what variable would I use to have it actually display the referred in the drop down menu? I can't figure it out... Right now I am trying the referrer value to make sure that it works and it does. I just cant seem to figure out what variable to use to display the correct information. Any ideas?

My referrer list bit:
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="#F1F1F1"><smallfont>$referrer[referrals]</smallfont></td>
    <
form><td bgcolor="#F1F1F1" valign="middle" align="right" nowrap>
<
SELECT NAME="newLoc" onChange="jumpPage(this.form.newLoc)" style="font-size: 7pt; background-color: #dfdfdf; font-family: Arial, Tahoma;" maxlength="20">
<
OPTION VALUE="#">---------------------</OPTION>
<
OPTION VALUE="member.php?s=$session[sessionhash]&action=getinfo&userid=$referrer[userid]">$referrer[username]</OPTION></select></td></form>
</
tr
My referrer list:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<
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="images/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="0" cellspacing="0" border="0" bgcolor="#555576"  width="100%" align="center"><tr><td>
<
table cellpadding="4" cellspacing="1" border="0"  width="100%">
<
tr align="center">
    <
td bgcolor="#DFDFDF"><smallfont><a href="memberlist.php?s=$session[sessionhash]&action=search"><b>Advanced Search</b></a></smallfont></td>
    <
td bgcolor="#DFDFDF"><smallfont><a href="memberlist.php?s=$session[sessionhash]&what=topposters&perpage=$memberlisttopposters"><b>Top $memberlisttopposters Posters</b></a></smallfont></td>
    <
td bgcolor="#DFDFDF"><smallfont><a href="memberlist.php?s=$session[sessionhash]"><b>List Alphabetically</b></a></smallfont></td>
    <
td bgcolor="#DFDFDF"><smallfont><a href="memberlist.php?s=$session[sessionhash]&what=datejoined"><b>List by Date Joined</b></a></smallfont></td>
<!-- 
Begin Referrals -->
<
td bgcolor="#F1F1F1"><smallfont><a href="referrerlist.php?s=$session[sessionhash]"><b>Referrals</b></a></smallfont></td>
<!-- 
End Referrals -->
<!-- 
Begin Forum Leaders -->
<
td bgcolor="#DFDFDF"><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="0" cellspacing="0" border="0"  width="250" align="center"><tr>
    <
td><div align="center">$topreferrer</div></td>
</
tr></table>
-->
<
p align="center">$topreferrer</p>
<
table cellpadding="0" cellspacing="0" border="0" bgcolor="#555576"  width="250" align="center"><tr><td>
<
table cellpadding="4" cellspacing="1" border="0"  width="250">
<
tr align="center">
  <
td bgcolor="#8080A6" align="center" width="100"><smallfont color="#EEEEFF"><b>Member</b></smallfont></td>
  <
td bgcolor="#8080A6" align="center" width="50"><smallfont color="#EEEEFF"><b>Referrals</b></smallfont></td>
  <
td bgcolor="#8080A6" align="center" width="100"><smallfont color="#EEEEFF"><b>Members Referred</b></smallfont></td>
</
tr>
$reflistbits
</table>
</
td></tr></table>

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

<!-- /
main -->
$footer
</body></html
Reply With Quote
  #27  
Old 09-01-2001, 08:45 PM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work. But the answer to your question is a bit involved and you'll have to play with it to get it right. You need to get the option statement out of the template and into the code. You need the option statement in a repeated loop or else you will only be able to get one username. I'm amazed that it isn't messing you up more.
Reply With Quote
  #28  
Old 09-01-2001, 10:14 PM
Joshs Joshs is offline
 
Join Date: Oct 2001
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think I have to make a new variable in the php file, but I dont know what to do. It is just the variable I need to figure out...
Reply With Quote
  #29  
Old 09-02-2001, 03:18 AM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope that's not the case. You aren't looking for a variable, you need to move the html for the drop down box into the code.

Why? When the reflistbit is called it runs one line, 3 <TD>'s. But you need to loop through the last <TD> containing the list of referrers as many times as there are referrers. So your <option> html HAS to be in the code not in the template. You don't need a new variable name. The same one will do but you need the html inside the code.
Reply With Quote
  #30  
Old 09-02-2001, 03:38 AM
Joshs Joshs is offline
 
Join Date: Oct 2001
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay I know that this code (below) will contain the $referrerlist I dont know what I have to incorporate into the php file, but I have no clue how to do it.

PHP Code:
<OPTION VALUE="member.php?s=$session[sessionhash]&action=getinfo&userid=$referrer[userid]">$referrer[username]</OPTION
Reply With Quote
  #31  
Old 09-02-2001, 04:06 AM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not using the topreferrer code and I looked at the code most of you are using but it was taking too long to adjust. So I'll post my code which is working great and hopefully you can figure it out.

BTW, looking at the code that was written for the top referrer, there was an unneeded template and an unneeded sql call.

The top referrer is the first userid that comes out in the loop. Simply set a variable the first time it is run then pull out all the sql code and extra template. So something like

if (!$topdone) {
$ref[userid]=$referred[userid];
$topdone=1;
}
placed right after the first fetch array should enable you to get rid of a bunch of code...

Anyways here's the code I'm using:
Code:
<?php
error_reporting(7);
$templatesused='reflistbit,reflist';
require('./global.php');
$max=25; //This number decides how many users to display
$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
                   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='20'><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("reflistbit")."\";");
	$referrerlist="";
}
eval("dooutput(\"".gettemplate("reflist")."\");");
?>
Reply With Quote
Reply


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:57 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05005 seconds
  • Memory Usage 2,373KB
  • Queries Executed 25 (?)
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
  • (2)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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