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™

How to specify a different registration page

s2Member Plugin. A Membership plugin for WordPress®.

How to specify a different registration page

Postby dwdutch » February 21st, 2011, 12:22 am

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?
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

Re: How to specify a different registration page

Postby Jason Caldwell » March 6th, 2011, 8:45 am

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);
~ 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: How to specify a different registration page

Postby dwdutch » March 29th, 2011, 10:38 pm

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();
               }
}
User avatar
dwdutch
Registered User
Registered User
 
Posts: 24
Joined: January 16, 2011

Re: How to specify a different registration page

Postby Cristián Lávaque » March 29th, 2011, 11:13 pm

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 ?>.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: How to specify a different registration page

Postby Jason Caldwell » March 31st, 2011, 6:24 am

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/
~ 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: How to specify a different registration page

Postby hardline » April 6th, 2011, 10:06 am

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?
User avatar
hardline
Registered User
Registered User
 
Posts: 14
Joined: April 6, 2011

Re: How to specify a different registration page

Postby Jason Caldwell » April 7th, 2011, 7:55 pm

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 )
~ 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


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron