PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Add the s2Member Registration/Login Form to Custom Design

Common Questions/Problems/Tips. Posted by Administrators & Support Reps.

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

Postby drbyte » April 15th, 2011, 9:54 pm

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
User avatar
drbyte
Experienced User
Experienced User
 
Posts: 269
Joined: May 6, 2010

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

Postby Jason Caldwell » April 16th, 2011, 5:54 am

Thanks Sam.
Yes, please report back if you can.
That would be great!
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

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

Postby bitofgrace » January 15th, 2012, 10:17 am

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'];
?>
User avatar
bitofgrace
Registered User
Registered User
 
Posts: 64
Joined: September 8, 2011

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

Postby Jason Caldwell » January 15th, 2012, 11:41 am

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 98 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
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

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

Postby bitofgrace » January 15th, 2012, 1:06 pm

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. : /
User avatar
bitofgrace
Registered User
Registered User
 
Posts: 64
Joined: September 8, 2011

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

Postby Raam Dev » January 18th, 2012, 2:02 pm

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.)
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

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

Postby bitofgrace » January 18th, 2012, 2:13 pm

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)
User avatar
bitofgrace
Registered User
Registered User
 
Posts: 64
Joined: September 8, 2011

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

Postby Raam Dev » January 18th, 2012, 10:41 pm

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.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

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

Postby bitofgrace » January 19th, 2012, 1:27 pm

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.
User avatar
bitofgrace
Registered User
Registered User
 
Posts: 64
Joined: September 8, 2011

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

Postby Raam Dev » January 23rd, 2012, 1:31 pm

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|*).
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

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

Postby bitofgrace » January 23rd, 2012, 1:36 pm

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.
User avatar
bitofgrace
Registered User
Registered User
 
Posts: 64
Joined: September 8, 2011

Previous

Return to Common Questions/Problems/Tips

Who is online

Users browsing this forum: No registered users and 1 guest

cron