The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Details »» | |||||||||||||||||||||||||
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
|
Comments |
#22
|
|||
|
|||
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. |
#23
|
||||
|
||||
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. |
#24
|
|||
|
|||
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? |
#25
|
|||
|
|||
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 |
#26
|
|||
|
|||
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:
PHP Code:
|
#27
|
||||
|
||||
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.
|
#28
|
|||
|
|||
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...
|
#29
|
||||
|
||||
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. |
#30
|
|||
|
|||
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:
|
#31
|
||||
|
||||
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")."\");"); ?> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|