Page 1 of 1

How to specify a different registration page

PostPosted: February 21st, 2011, 12:22 am
by dwdutch
I have a custom registration page and prefer to use it rather than the S2member's page.

What's necessary to specify use of an alternative registration page?

Re: How to specify a different registration page

PostPosted: March 6th, 2011, 8:45 am
by Jason Caldwell
dwdutch wrote:I have a custom registration page and prefer to use it rather than the S2member's page. What's necessary to specify use of an alternative registration page?

With s2Member Pro, configured to work with PayPal Pro and/or Authorize.Net, you can use the built-in Registration and/or Checkout Forms provided by s2Member. This will allow you to build them into your theme by adding Shortcodes to a Post/Page in WordPress.

That being said, if you want to redirect requests for this page:
/wp-login.php?action=register

You can do something like this.
  • Create this directory:
    /wp-content/mu-plugins/
  • Create this file:
    /wp-content/mu-plugins/s2-hacks.php
    ( file name is not important, you can name it whatever you like )
  • Inside the file, add this PHP code:
    Code: Select all
    <?php
    if(strpos($_SERVER["REQUEST_URI"], "wp-login.php") !== false && $_GET["action"] === "register"){
        header("Location: http://www.example.com/my-registration-page/"); exit();
    }
    ?>
TIP: When creating custom registration forms, if those custom registration forms are also being processed by your own custom routines, be sure that your custom registration routines always make a call to this function: wp_create_user(), or wpmu_create_user() on a Multisite Network. This way the right Hooks/Filters are processed internally by s2Member. If that is not possible, then make sure your custom routine is at least firing this Hook after it creates an account: do_action("user_register", $user_id);

Re: How to specify a different registration page

PostPosted: March 29th, 2011, 10:38 pm
by dwdutch
Thanks for the input.

On my first stab at this, it yielded the following complaint:
Warning: Cannot modify header information - headers already sent by (output started at /hermes/.../mac/wp-content/mu-plugins/s2-hacks.php:1) in /hermes/.../mac/wp-content/mu-plugins/s2-hacks.php on line 3


With some poking around, I modified your initial suggestion by incorporating a suggestion from nickohrm found at http://stackoverflow.com/questions/1976781/redirecting-wordpresss-login-register-page-to-a-custom-login-registration-page. As a result, I added the following into a plug-in:
Code: Select all
add_action('init','tmm_redirect');
function tmm_redirect() {
              global $pagenow;
              if( 'wp-login.php' == $pagenow && $_GET["action"] === "register") {
                         wp_redirect('http://www.example.com/my-registration-page/');
                         exit();
               }
}

Re: How to specify a different registration page

PostPosted: March 29th, 2011, 11:13 pm
by Cristián Lávaque
I just wanted to mention that that error may be caused by a space outside the PHP tags. Make sure there's not even a single space before the <?php or after the ?>.

Re: How to specify a different registration page

PostPosted: March 31st, 2011, 6:24 am
by Jason Caldwell
Cristián is correct, spaces are "bytes" too. So when there are spaces or any sort of white space ( i.e. line breaks, tabs, null bytes, or just simple spaces ), you will see header errors like you've reported here.

Here are some related articles:
http://www.opencart.com/index.php?route ... &path=7_65
http://www.hongkiat.com/blog/wordpress- ... formation/
http://www.tech-recipes.com/rx/1489/sol ... eady-sent/

Re: How to specify a different registration page

PostPosted: April 6th, 2011, 10:06 am
by hardline
I'm looking to do the same thing. I tried the code and got an error as well. Do you have the correct code to redirect for our custom registration page?

Also, for the registration fields what are the name="" info for each of the required info as well as custom fields?

Re: How to specify a different registration page

PostPosted: April 7th, 2011, 7:55 pm
by Jason Caldwell
I can confirm this code works when placed inside this file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
if 
(strpos ($_SERVER["REQUEST_URI"], "wp-login.php") !== false && $_GET["action"] === "register")
    {
        header ("Location: http://www.example.com/my-registration-page/"); exit ();
    }
?>
* Please make sure there are no spaces/tabs/line breaks before or after <?php ?>.
Also, please make sure you upload all PHP files in ASCII mode with your FTP client. I recommend FileZilla.

Also, for the registration fields what are the name="" info for each of the required info as well as custom fields?

Code: Select all
ws_plugin__s2member_custom_reg_field_first_name
ws_plugin__s2member_custom_reg_field_last_name
ws_plugin__s2member_custom_reg_field_{your custom registration field id}
( ex: ws_plugin__s2member_custom_reg_field_country_code )