Page 1 of 1

free registration with fields prefilled from email

PostPosted: August 1st, 2011, 4:27 pm
by svillee
I have a WordPress site with s2Member Pro installed. I'd like to allow free registrations, but only through a link that would be included in an "invitation" email. When the user clicks on this link, it would take him to a page containing the Free Registration Form, but with the first three fields (First Name, Last Name, Email Address) prefilled with values given in the email. I'd also like a Custom Registration Field, say "Key", prefilled with a value given in the email. Ideally, I'd like this "Key" field to be hidden on the form, but I'd settle for it being visible and prefilled.

So the link in the invitation email might look something like this:

Code: Select all
http://oursite.com/invited-free-registration/?fname=John&lname=Smith&email=jsmith%40gmail.com&key=31416


Is the s2Member-Pro-PayPal-Form shortcode flexible enough to allow this? Thanks in advance for any help.

Re: free registration with fields prefilled from email

PostPosted: August 1st, 2011, 10:32 pm
by Cristián Lávaque
I seem to remember Jason mentioning in the past how one could pass values in the URL that'd prefill the form, but I'm not being able to find it, so it may just have been a dream I had. :P

Since you'd be inviting them, instead of having a free registration form up there where someone that finds it could use it although he wasn't invited...

You already have their names, email address and keys, why not just create their accounts using s2Member Pro's Import tool and then send them the email saying they just need to generate the password to activate it? viewtopic.php?f=4&t=1163&p=9032#p9032

Would that work?

Re: free registration with fields prefilled from email

PostPosted: August 2nd, 2011, 9:31 am
by svillee
Using s2Member Pro Import would be appropriate if I had a one-time batch of people to invite. But my situation is different. At various times, an event will happen that triggers an invitation, and I want to automate this as much as possible.

Yes, there's always a risk that an uninvited guest will find the free registration form, but I think I can at least keep search engines from finding it.

I think I found a solution based on some information in this post. I'll use a special template for the free registration form, and I'll put this code near the top of the template:

Code: Select all
if ($_GET['email']) {
  if (!is_array($_POST))
    $_POST = array();
  if (!is_array($_POST['s2member_pro_paypal_registration']))
    $_POST['s2member_pro_paypal_registration'] = array();
  if (!is_array($_POST['s2member_pro_paypal_registration']['custom_fields']))
    $_POST['s2member_pro_paypal_registration']['custom_fields'] = array();
  $_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']['key'] = $_GET['key'];
}


This seems to be effective in getting the fields prefilled in the form.

Re: free registration with fields prefilled from email

PostPosted: August 2nd, 2011, 11:27 pm
by Cristián Lávaque
Great!

That was the thread with Jason's post I remembered. viewtopic.php?f=4&t=3029&p=11814#p11814 Thanks for finding it. :)

Re: free registration with fields prefilled from email

PostPosted: October 6th, 2011, 4:23 pm
by bitofgrace
Svillee just wondering if you have any recommendations on how to hide the free registration form - so that only your invited guests are reaching it?

Sounds like i'll be using this same method to get around the penny payment in pre-registrations.

-grace

Re: free registration with fields prefilled from email

PostPosted: October 7th, 2011, 12:37 pm
by svillee
I just put the free registration form on a page whose URL is hard to guess, and made sure no menu refers to that page. So only people who have received the appropriate email should be able to reach it.

If a hacker somehow guesses the URL and does an unauthorized free registration, the admin can just delete that user.

Re: free registration with fields prefilled from email

PostPosted: October 7th, 2011, 12:42 pm
by bitofgrace
Ahh ok-
I've gone a step further and added it as a disallow on my robots.txt and noindexing on my htaccess as well. Really don't want folks finding it via search engine results :/

-grace