latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Success (Thank-You) Page

Home Forums Community Forum Success (Thank-You) Page

This topic contains 8 replies, has 2 voices. Last updated by  Raam Dev 4 years, 6 months ago.

Topic Author Topic
Posted: Monday Jul 9th, 2012 at 3:10 pm #18690
Hamid
Username: zawiyaprojects

When using the success (thank-you) page as mention in one of your how tos, is it normal NOT to receive an email confirmation with the s2member generated password.

I set up a s2member pro form with success url and some data from the form fields, for example:

[s2Member-Pro-PayPal-Form success=""http://www.domain.com/thank-you/?email=%%user_email%%&fname=%%user_first_name%%&gender_title=%%gender_title%%"" register="1" level="0" ccaps="" desc="Signup now, it's Free!" custom="www.domain.com" tp="0" tt="D" captcha="white"/] 

When registering a subscriber, the redirect does go to the thank-you page but no email is sent.

Q1: Is this normal behavior?

Q2: How do I pass a custom registration field to the thank-you page. In this case the “gender_title”? The first name appears in the thank-you page but not the custom field (gender_title).

Thanks

List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Tuesday Jul 10th, 2012 at 12:28 am #18766
Raam Dev
Username: Raam
Staff Member

Hi Hamid,

The first thing I noticed is that you have two extra double-quotes on the success= attribute.

This:

success=""http://www.domain.com/thank-you/?email=%%user_email%%&fname=%%user_first_name%%&gender_title=%%gender_title%%""

should be:

success="http://www.domain.com/thank-you/?email=%%user_email%%&fname=%%user_first_name%%&gender_title=%%gender_title%%"

Regarding the email issue: Can you tell me what “Allow Custom Passwords during Registration?” is set to in Dashboard -› s2Member® -› General Options -› Registration/Profile Fields?

Regarding passing Custom Registration Fields in the success URL: You should be able to use %%gender_title%%. Please see Dashboard -› s2Member® -› PayPal® Pro Forms -› Custom Return URLs Upon Success.

Posted: Tuesday Jul 10th, 2012 at 3:22 am #18782
Hamid
Username: zawiyaprojects

Hello Raam

[Allow Custom Passwords during Registration] is set to “No (send auto-generated password via email; after registration)”.

I had deleted the original success url so I can’t say if it had the double double quotes. I re-entered it correctly and will let you know what happens.

Here is my mu-plugin code for s2hacks.php. I added a line for gender_title:

<?php
add_action('ws_plugin__s2member_during_configure_user_registration', 's2_redirect_after_registration');
        function s2_redirect_after_registration($vars = array()) {
                if (!is_admin() && $vars['processed'] === 'yes') {
                $thank_you_page = "http://www.domain.com/thank-you/";
                wp_redirect($thank_you_page . '?email=' . urlencode($vars['email']) .
                '&gender_title=' . urlencode($vars['gender_title']) .
                '&fname=' . urlencode($vars['fname']) .
                '&lname=' . urlencode($vars['lname']) .
                '&username=' . urlencode($vars['login']) );
                exit();
                }
        }
?>

And here is my code for the thank-you page

Hello  <?php echo $_GET['gender_title']; ?> <?php echo $_GET['fname']; ?>

Thank you for joining Domain.com.

We hope you enjoy your free membership which will entitle you to free content on a regular basis.

If you end up loving our lessons, you can always upgrade to a paid subscription that will give you access to more downloads.

Looking forward to serving you at Domain.com

To log into your account, please check your email address for your auto-generated password.

Admin

Are all the components set up correctly? (I will test it now and get back to you :)

Posted: Tuesday Jul 10th, 2012 at 3:36 am #18783
Hamid
Username: zawiyaprojects

OK here what happens.

1.) Registration goes through and member is redirected to the thank-you page.

2.) The thank-you page does not display custom registration field “gender_title” before first name but it does display first name:

Hello  Hamid

Thank you for joining Domain.com.

We hope you enjoy your free membership which will entitle you to free content on a regular basis.

If you end up loving our lessons, you can always upgrade to a paid subscription that will give you access to more downloads.

Looking forward to serving you at Domain.com

To log into your account, please check your email address for your auto-generated password.

Admin

3.) No email is send to new user with their auto-generated password.

4.) No email is sent to admin (informing that a new user has registered).

Posted: Tuesday Jul 10th, 2012 at 3:52 am #18785
Hamid
Username: zawiyaprojects

Getting there…

I removed all reference to the custom field “gender_title” in the s2hacks.php and in the success URL and in the thank-you page and it now sends out an email to the user with their auto-generated password. But it does NOT send an email to the admin informing that a user has registered.

1.) What am I doing wrong with the custom field?

2.) Why do I not get an email informing a user has registered.

Posted: Tuesday Jul 10th, 2012 at 4:08 am #18787
Hamid
Username: zawiyaprojects

I dont know what changed but after getting a confirmation email with auto-generated password after registering the first user, all subsequent registration attempts does not send out an email to the user or admin.

I have to step away from this for a minute…

Posted: Wednesday Jul 11th, 2012 at 2:03 am #18865
Raam Dev
Username: Raam
Staff Member

Hi Hamid,

There were a few problems with my initial code example. Please see the updated example here and replace your existing code with the new example. I also included an example of passing a custom field.

Posted: Wednesday Jul 11th, 2012 at 5:06 am #18894
Hamid
Username: zawiyaprojects

I love you Raam, you rock. It all works now. However I would like to point out a syntax error.

In your s2hack.php, you have the following

<?php
add_action('ws_plugin__s2member_after_configure_user_registration', 's2_redirect_after_registration');
function s2_redirect_after_registration($vars = array()) {
    if (!is_admin() && $vars['processed'] === 'yes') {
	
        $_POST['redirect_to'] = "http://example.com/thank-you/" . 
        			'?email=' . urlencode($vars['email']) . 
				'&fname=' . urlencode($vars['fname']) . 
				'&lname=' . urlencode($vars['lname']) .
				'&my_custom_field=' . urlencode($vars['fields']['my_custom_field']) .
				'&username=' . urlencode($vars['login']) );
    }
}
?>

the &username line has an extra ). It should read

<?php
add_action('ws_plugin__s2member_after_configure_user_registration', 's2_redirect_after_registration');
function s2_redirect_after_registration($vars = array()) {
    if (!is_admin() && $vars['processed'] === 'yes') {
	
        $_POST['redirect_to'] = "http://example.com/thank-you/" . 
        			'?email=' . urlencode($vars['email']) . 
				'&fname=' . urlencode($vars['fname']) . 
				'&lname=' . urlencode($vars['lname']) .
				'&my_custom_field=' . urlencode($vars['fields']['my_custom_field']) .
				'&username=' . urlencode($vars['login']) ;
    }
}
?>

Again thanks so much for your help, I’m sooooooo happy!!!

Now on to the next piece. I’m loving s2member, I just hope you guys dont get tired of me :)

Posted: Thursday Jul 12th, 2012 at 1:58 am #18984
Raam Dev
Username: Raam
Staff Member

Ah, thank you for pointing out that syntax error, Hamid! I’ve updated the original KB article. :)

Viewing 8 replies - 1 through 8 (of 8 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.