Page 2 of 2

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: April 15th, 2011, 9:54 pm
by drbyte
Hi Jason

I tried for few hours last night to get the registration info to pass to the credit card form but I kept getting error on the registration page where it kept asking me for the first name....I will try your suggestion later on tonight..thank you

Sam

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: April 16th, 2011, 5:54 am
by Jason Caldwell
Thanks Sam.
Yes, please report back if you can.
That would be great!

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 15th, 2012, 10:17 am
by bitofgrace
I'm attempting to use the Free Registration Forms $POST lines mentioned earlier as a means of prefilling the form from an email that supplies the user with a unique 10digit code and link to the form.

Ultimately i wanted to validate that code against a list on the server- but have not found a way to do that.
So - i could use a lil help figuring out how to prefill the reg form with the code from the user's linked email.

i may have added the the chunk to the reg form php improperly - because it rendered no change when clicked to that page from email. The email does have matching field names (fname, lname, email, reg_code on s2 is regcode in the email)

Am i missing something to call at the top?:
Code: Select all
<?php
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
   exit("Do not access this file directly.");


  $_POST['s2member_pro_paypal_registration']['first_name'] = $_GET['fname'];
  $_POST['s2member_pro_paypal_registration']['last_name'] = $_GET['lname'];
  $_POST['s2member_pro_paypal_registration']['email'] = $_GET['email'];
  $_POST['s2member_pro_paypal_registration']['custom_fields']['reg_code'] = $_GET['regcode1'];
?>

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 15th, 2012, 11:41 am
by Jason Caldwell
Thanks for your inquiry.
You might try something like this with your code.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
( these are MUST USE plugins, see: http://codex.wordpress.org/Must_Use_Plugins )
Code: Select all
<?php
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
    exit("Do not access this file directly.");
/**/
add_action("init", "my_s2_prefills", 1);
function my_s2_prefills()
    {
        if(!isset($_POST["s2member_pro_paypal_registration"]))
            {
                $_POST["s2member_pro_paypal_registration"]["first_name"] = @$_GET["fname"];
                $_POST["s2member_pro_paypal_registration"]["last_name"] = @$_GET["lname"];
                $_POST["s2member_pro_paypal_registration"]["email"] = @$_GET["email"];
                $_POST["s2member_pro_paypal_registration"]["custom_fields"]["reg_code"] = @$_GET["regcode1"];
            }
    }
?>
s2-hacks.zip
(435 Bytes) Downloaded 97 times

It would also be a good idea to add a conditional page check, so this code only runs on the page where your s2Member Pro Form is at. So for instance, you might do something like this.
Code: Select all
<?php
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
    exit("Do not access this file directly.");
/**/
add_action("init", "my_s2_prefills", 1);
function my_s2_prefills()
    {
        if(strpos($_SERVER["REQUEST_URI"], "/my-free-registration-form-slug") !== false)
                if(!isset($_POST["s2member_pro_paypal_registration"]))
                    {
                        $_POST["s2member_pro_paypal_registration"]["first_name"] = @$_GET["fname"];
                        $_POST["s2member_pro_paypal_registration"]["last_name"] = @$_GET["lname"];
                        $_POST["s2member_pro_paypal_registration"]["email"] = @$_GET["email"];
                        $_POST["s2member_pro_paypal_registration"]["custom_fields"]["reg_code"] = @$_GET["regcode1"];
                    }
    }
?>
See also: http://codex.wordpress.org/Function_Reference/is_page

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 15th, 2012, 1:06 pm
by bitofgrace
ok - s2-hacks.php is in place - with the appropriate slug,
the email link gets through to the correct page.. but nothing pre-filled.

i'm missing something but have no idea what. : /

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 18th, 2012, 2:02 pm
by Raam Dev
Could you post the URL with all the query variables for us to check? (You can remove the domain if you don't want to share that part.)

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 18th, 2012, 2:13 pm
by bitofgrace
Not sure what url to give you.. or how without the domain? (domain doesnt publicly launch til the 20th so i cant share in forum)

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 18th, 2012, 10:41 pm
by Raam Dev
You said earlier you were trying to prefill the pro-form from an email. Is your customer clicking on a link in an email and arriving at the pro-form?

The code Jason supplied uses query variables (e.g., &fname=Raam) from the URL and assigns them to the Pro Form field (@$_GET["fname"]).

So, you'll need to be calling the Pro Form URL with something like http://example.com/pro-form-order-page/?fname=Raam&lname=Dev&email=raam@example.com&reg_code=ABC123.

I was asking for the URL you're using so that I can check to make sure the query variables are properly configured in the URL. If they're not properly configured, the Pro Form fields won't be filled in.

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 19th, 2012, 1:27 pm
by bitofgrace
Ohhh I getcha now.

The emailer is merged with the fields:
lname
fname
regcode
regcode2
eot
email

the link is to the page where the form is embedded: domain.com/stringcharachtersasaname/

so, would i make the link something like this instead:
domain.com/stringcharachtersasaname/?fname=[fname]&lname=[lname]&email=[email]&reg_code=[regcode]

??
i have no idea how to call the =[] properly
i'm working from Mailchimp list.

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 23rd, 2012, 1:31 pm
by Raam Dev
Are you sending that email from MailChimp and trying to use MailChimp's MERGE tags in the email to create the correct URL? If yes, then I suggest that you read MailChimp's How to Use Merge Tags.

Your example above looks correct if MailChimp's merge tags would replace [fname] with the First Name of the person (I think you have that part wrong... if I remember correctly, MailChimp uses the format of *|FNAME|*).

Re: Add the s2Member Registration/Login Form to Custom Desig

PostPosted: January 23rd, 2012, 1:36 pm
by bitofgrace
ohhh i see what you mean rather than brackets - match it to Mailchimp *|

have already sent out the 10,000 invites unfortunately, but that wont likely be the last time i need to do it.

Thank you.