Make 'Referrer' field in registration UNeditable if from 'referrerid' in URL
This modification is in the archives.
Hello.
If you'd like to make the 'Referrer' field username UNEDITABLE if a link is followed in a referral URL, here is a solution WITHOUT hacking the 'register.php' file. (ref: http://www.vbulletin.com/forum/index.php?t=132386) STEP 1: In 'Plugin Manager', assign this new plugin a 'Hook Location' of 'register_form_complete' and give it a 'Title'. You'll then create an arbitrary variable and the conditional statements in which its value will be assigned by doing the following: Add in the 'Plugin PHP Code' text area this code: PHP Code:
if (empty($referrername)) {$ref_var = 0;}
STEP 2: In the 'register' template, Find this code: Code:
<if condition="$show['referrer']"> Code:
<if condition="$show['referrer'] && $ref_var == 0"> Code:
</if> Add this code: Code:
<else /> <input type="hidden" name="referrername" value="$referrername" /> In summary, if there is no referrerid on the URL OR if it is but it doesn't match a username in the database, the $referrername var will be empty and therefore, the $ref_var will be assigned the value of '0' whereby the 'Referrer' field in the Registration Form will be visible for manual entry. If the username is found in the database, the 'Referrer' field will not be shown but its data in the form of the username found will be sent to the server upon form submission so that username gets the credit for the new member. ENJOY! P.S. Note: My assessment is, once the referrerid is accepted by the software after locating the username in the database, the information is saved in a cookie even if registration is not completed in that session. Therefore, even when all browser windows are closed and PC is turned off, the next time the Registration Form is loaded, that field will be 'hidden' from the form and 'UNeditable'. Once the form is submitted, that credit will be given to that 'username'. Bottom line: IF YOU'RE USING A SHARED COMPUTER, you may need to remove that 'bbreferrerid' cookie from your computer manually or the credit to that username will be coming from someone else who's registering and who may not have used a 'referred' URL. I'll leave those cookie-removal steps to others to explain. Download This modification is archived and cannot be downloaded. |
Similar Mods
Make 'Contact Us' Name & E-mail fields uneditable for log'd in members | vBulletin 3.5 Template Modifications |