vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [RESOLVED]Fetch email just like referral id from url in register form?? (https://vborg.vbsupport.ru/showthread.php?t=222015)

nirvana43 08-29-2009 12:36 AM

[RESOLVED]Fetch email just like referral id from url in register form??
 
Hello
Can anyone tell me how can i get email address field on register form, from url?
Just like referral link i.e. http://www.myforum.com/register.php?referrerid=10
I will be generating links as http://www.myforum.com/register.php?referrerid=10&email=username@email.com
What i wanna do is, just like referralid is taken from url and set in referral field of register form, i wanna take email from url and set it on the filed in register form.
Now i have already done customization till register link with referral id and email generation.
All i wanna know is, how do i catch email id from url...
I mean which files i'm suppose to edit?
And yeah there is "Agree to Forum Rules" thing before registration form actually appears (And i know vbulletin uses cookies to get referral id from actual link or something like that). so please tell me how do i add email to this system?

Detailed instructions are strongly appreciated and helper will get full credits. :)

Brandon_R 08-29-2009 12:47 AM

You would have to use a $_GET

Code:

$refferalemail = $vbulletin->input->clean_gpc('g', 'email', TYPE_STR);

Make a plugin in the register hooks and put the above code in it. Make sure to modify it to your needs.

And in the registration templates (pretty sure its register_rules) find the email input fields and inside the email input fields put value="$refferalemail"

If you want the email link to carry over from the Accecpt Forum Rules page to the registration rules page you will have to modify the "Form Action" in the template register. find (<form action=") and at the end of the link put (&amp;email=$refferalemail)

nirvana43 08-29-2009 07:52 AM

Thank You Brandon
I will PM you 1ce i'm done with coding... you will get full credits in code. :)

nirvana43 09-05-2009 03:11 AM

Nop its not working...
I tried adding above code for following template hooks :
register_start
register_signup
register_form_start
register_requestemail


Also my register template looks like this now :
Code:

$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - <if condition="$show['coppa']">$vbphrase[coppa] </if>$vbphrase[registration]</title>
</head>
<body>

$header

<br />

<if condition="$show['coppa']">
        <div>$vbphrase[until_receive_signed_form]</div>
</if>

<if condition="$show['errors']">
        <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <tr>
                <td class="tcat">$vbphrase[errors_occurred_during_registration]</td>
        </tr>
        <tr>
                <td class="alt1"><ul>$errorlist</ul></td>
        </tr>
        </table>
        <br />
</if>

<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script>
<script type="text/javascript">
function verify_passwords(password1, password2)
{
        // do various checks, this will save people noticing mistakes on next page
        if (password1.value == '' || password2.value == '')
        {
                alert('$vbphrase[fill_out_both_password_fields]');
                return false;
        }
        else if (password1.value != password2.value)
        {
                alert('$vbphrase[entered_passwords_do_not_match]');
                return false;
        }
        else
        {
                <if condition="$show['coppa']">
                pass_copy = password1.value;
                passconfirm_copy = password2.value;
                </if>

                var junk_output;

                md5hash(password1, document.forms.register.password_md5, junk_output, $show[nopasswordempty]);
                md5hash(password2, document.forms.register.passwordconfirm_md5, junk_output, $show[nopasswordempty]);

                <if condition="$show['coppa']">
                document.forms.register.password.value = pass_copy;
                document.forms.register.passwordconfirm.value = passconfirm_copy;
                </if>

                return true;
        }
        return false;
}
</script>

<form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm);">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="hidden" name="do" value="addmember" />
<input type="hidden" name="url" value="$url" />
<input type="hidden" name="agree" value="$agree" />
<input type="hidden" name="password_md5" />
<input type="hidden" name="passwordconfirm_md5" />
<input type="hidden" name="$User_form_random_name" value="$User_form_random_value" />
<input type="hidden" name="$vboptions[StopBotReg_userpage_hash]" value="$StopBotRegHash" />
<if condition="!$show['birthday']">
        <input type="hidden" name="day" value="$day" />
        <input type="hidden" name="month" value="$month" />
        <input type="hidden" name="year" value="$year" />
</if>
<if condition="$show['coppa']">
        <input type="hidden" name="coppauser" value="1" />
</if>

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat"><phrase 1="$vboptions[bbtitle]">$vbphrase[register_at_x]</phrase></td>
</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div style="width:$stylevar[formwidth]" align="$stylevar[left]">

                        <div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
                                <phrase 1="$vboptions[bbtitle]">$vbphrase[to_post_must_first_register]</phrase>
                        </div>

                        <div class="smallfont" style="margin-bottom:$stylevar[formspacer]px">
                                <strong>$vbphrase[username]</strong>:<br />
                                <input type="text" class="bginput" name="username" size="50" maxlength="$vboptions[maxuserlength]" value="$username" />
                        </div>

                        <fieldset class="fieldset">
                                <legend>$vbphrase[password]</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="400">
                                <tr>
                                        <td colspan="2">$vbphrase[enter_password_for_account]</td>
                                </tr>
                                <tr>
                                        <td>
                                                $vbphrase[password]:<br />
                                                <input type="password" class="bginput" name="password" size="25" maxlength="50" value="$password" />
                                        </td>
                                        <td>
                                                $vbphrase[confirm_password]:<br />
                                                <input type="password" class="bginput" name="passwordconfirm" size="25" maxlength="50" value="$passwordconfirm" />
                                        </td>
                                </tr>
                                </table>
                        </fieldset>

                        <fieldset class="fieldset">
                                <legend>$vbphrase[email_address]</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="400">
                                <tr>
                                        <td colspan="2">$vbphrase[enter_valid_email_address]</td>
                                </tr>
                                <tr>
                                        <td>
                                                $vbphrase[email_address]:<br />
                                                <input type="text" class="bginput" name="email" size="25" maxlength="50" value="$refferalemail" dir="ltr" />
                                        </td>
                                        <td>
                                                $vbphrase[confirm_email_address]:<br />
                                                <input type="text" class="bginput" name="emailconfirm" size="25" maxlength="50" value="$refferalemail" dir="ltr" />
                                        </td>
                                </tr>
                                <if condition="$show['coppa']">
                                <tr>
                                        <td>$vbphrase[if_under_13_provide_parent]</td>
                                </tr>
                                <tr>
                                        <td>
                                                $vbphrase[parent_guardian_email]:<br />
                                                <input type="text" class="bginput" name="parentemail" size="25" maxlength="50" value="$parentemail" dir="ltr" />
                                        </td>
                                </tr>
                                </if>
                                </table>
                        </fieldset>

                        $human_verify

                </div>
        </div>
        </td>
</tr>
</table>
<br />

<if condition="$show['customfields_profile']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead">$vbphrase[additional_required_information_profile]</td>
</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div style="width:$stylevar[formwidth]" align="$stylevar[left]">

                        $customfields_profile

                        <if condition="$show['birthday']">$birthdayfields</if>

                </div>
        </div>
        </td>
</tr>
</table>
<br />
</if>

<if condition="$show['customfields_option']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead">$vbphrase[additional_required_information_option]</td>
</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div style="width:$stylevar[formwidth]" align="$stylevar[left]">

                        $customfields_option

                </div>
        </div>
        </td>
</tr>
</table>
<br />
</if>

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead">$vbphrase[additional_information]</td>
</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div style="width:$stylevar[formwidth]" align="$stylevar[left]">

                        <if condition="$show['referrer']">
                        <fieldset class="fieldset">
                                <legend>$vbphrase[referrer]</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
                                <tr>
                                        <td><phrase 1="$vboptions[bbtitle]">$vbphrase[if_referred_enter_name]</phrase></td>
                                </tr>
                                <tr>
                                        <td>
                                                $vbphrase[referrer]:<br />
                                                <div id="referrerfield"><input id="referrerfield_txt" type="text" class="bginput" name="referrername" value="$referrername" size="50" maxlength="$vboptions[maxuserlength]" /></div>
                                                <if condition="$show['popups']">
                                                        <div id="referrerfield_menu" class="vbmenu_popup" style="display:none; z-index:50"></div>
                                                        <script type="text/javascript" src="clientscript/vbulletin_ajax_namesugg.js?v=$vboptions[simpleversion]"></script>
                                                        <script type="text/javascript">
                                                        <!--
                                                                vbmenu_register('referrerfield', true);
                                                                rnc = new vB_AJAX_NameSuggest('rnc', 'referrerfield_txt', 'referrerfield');
                                                                rnc.allow_multiple = false;
                                                        //-->
                                                        </script>
                                                </if>
                                        </td>
                                </tr>
                                </table>
                        </fieldset>
                        </if>

                        $timezoneoptions

                        <fieldset class="fieldset">
                                <legend>$vbphrase[receive_email]</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
                                <tr>
                                        <td>
                                                $vbphrase[administrators_may_send_email]
                                        </td>
                                </tr>
                                <tr>
                                        <td><label for="cb_adminemail"><input type="checkbox" name="options[adminemail]" value="1" id="cb_adminemail" $checkedoff[adminemail] />$vbphrase[receive_email_from_bulletin_board_staff]</label></td>
                                </tr>
                                <if condition="$show['email']">
                                <tr>
                                        <td>$vbphrase[allow_members_send_you_email]</td>
                                </tr>
                                <tr>
                                        <td><label for="cb_showemail"><input type="checkbox" name="options[showemail]" value="1" id="cb_showemail" $checkedoff[showemail] />$vbphrase[receive_email_from_other_members]</label></td>
                                </tr>
                                </if>
                                </table>
                        </fieldset>


                        $customfields_other

                </div>
        </div>

        <div style="margin-top:$stylevar[cellpadding]px">
                <input type="submit" class="button" name="timeremaining" value="$vbphrase[complete_registration] in $vboptions[StopBotRegMinTime]" accesskey="s" onsubmit"submit_form()") />
                <input type="reset" class="button" name="Reset" value="$vbphrase[reset_fields]" />
<script type="text/javascript" language="javascript">
<!--
countdown = $vboptions[StopBotRegMinTime];
actualcountdown = $vboptions[StopBotRegMinTime];
function submit_form()
{
  if(actualcountdown <=0)
  {
        document.register.submit();
    }
    else
    {
        alert("Please wait " + actualcountdown + " seconds more before submitting your registration form.");
    }
}

function count_down()
{
    actualcountdown = actualcountdown-1;
    if (actualcountdown <= 0)
    {
                document.register.timeremaining.disabled=false;
                document.register.timeremaining.value='Click to Register';
    }
        else
        {
                document.register.timeremaining.disabled=true;
                document.register.timeremaining.value=actualcountdown+ ' seconds remaining before you can click Submit.';
                setTimeout('count_down()',1000);
        }
}
setTimeout('count_down()',1000);
//-->
</script>

        </div>
        </td>
</tr>
</table>

</form>

$footer

</body>
</html>

But its not taking email field from url.
This is the url i tried :
Code:

http://www.mywebsite.org/forums/register.php?referrerid=10&email=username@gmail.com

Brandon_R 09-05-2009 10:57 AM

Maybe the email variable is conflicting with another variable that vBulletin uses. Try adding this plugin in the register_start hook.

Code:

$refferalemail = $vbulletin->input->clean_gpc('g', 'refferalemail', TYPE_STR);
And replace the email input fields with

HTML Code:


                                <tr>
                                        <td>
                                                $vbphrase[email_address]:<br />
                                                <input type="text" class="bginput" name="email" size="25" maxlength="50" value="$refferalemail" dir="ltr" />
                                        </td>
                                        <td>
                                                $vbphrase[confirm_email_address]:<br />
                                                <input type="text" class="bginput" name="emailconfirm" size="25" maxlength="50" value="$refferalemail" dir="ltr" />
                                        </td>
                                </tr>

And the form action with

HTML Code:

action="register.php?do=register&amp;refferalemail=$refferalemail"

nirvana43 09-06-2009 03:26 AM

Thanks a million brandon!!! that worked!! :)

nirvana43 01-07-2010 12:29 AM

Sorry to dig this again but how it can be done in vb4???
The code provided by Brandon (this one) works perfect on vb 3
please somebody tell me how it can be done in vb4??


All times are GMT. The time now is 02:27 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.01679 seconds
  • Memory Usage 1,822KB
  • 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
  • (2)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete