Community Support Forums — WordPress® ( Users Helping Users ) — 2010-08-30T13:44:19-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=441 2010-08-30T13:44:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2714#p2714 <![CDATA[Re: Front End Registration and Login]]>
martonic wrote:
Hi Jason,

Thank you very much. I wound up using a custom page that posts to itself, thus removing WP from the equation completely - creating a password, entering the user in the database, including the s2Member fields, and sending their email "by hand". At least it provides full control over all the details - although, as you imply, it might not work correctly down the road if "things change".

That works too. Glad to hear you got it working.

Statistics: Posted by Jason Caldwell — August 30th, 2010, 1:44 pm


]]>
2010-08-30T00:41:11-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2663#p2663 <![CDATA[Re: Front End Registration and Login]]>
Thank you very much. I wound up using a custom page that posts to itself, thus removing WP from the equation completely - creating a password, entering the user in the database, including the s2Member fields, and sending their email "by hand". At least it provides full control over all the details - although, as you imply, it might not work correctly down the road if "things change".

Statistics: Posted by martonic — August 30th, 2010, 12:41 am


]]>
2010-08-29T23:45:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2655#p2655 <![CDATA[Re: Front End Registration and Login]]>
You can use these functions for that:
Code:
$id = wp_create_user(login, pass, email)
wp_new_user_notification($id, pass)

Check the WordPress® Codex for further details.
OR, you can have a look at paypal-checkout.inc.php
in the s2Member Pro distribution for actual examples.

In short, the `wp_create_user()` function will fire the "user_register" Hook in WordPress®, which triggers s2Member as well. So if you POST data to a custom processing routine that receives form input, and calls `wp_create_user()`, you've got a truly custom integration.

Statistics: Posted by Jason Caldwell — August 29th, 2010, 11:45 pm


]]>
2010-08-24T18:57:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2564#p2564 <![CDATA[Re: Front End Registration and Login]]>
Even after all the above, when you put in a name that is already in use, or a bad email, the function still redirects to the "usual" log-in page with the error messages attached. :o

Drat!

Statistics: Posted by martonic — August 24th, 2010, 6:57 pm


]]>
2010-08-23T17:00:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2526#p2526 <![CDATA[Re: Front End Registration and Login]]> SOLVED

Here is the code you need for the hook:

Code:
add_action("init", "redirect_registrations");
function redirect_registrations() {
    if(preg_match("/wp-login\.php/", $_SERVER["REQUEST_URI"])
       && $_GET["action"] === "register" && $_GET["register"] !== "1")
    { header("Location: /bg-register.php"); exit(); }


Note the addition of:

Code:
&& $_GET["register"] !== "1"


This additional test is needed because the same file and the same action are used both to present the registration form, and to process it!

Then, in your custom registration form, use this action:

Code:
action="/wp-login.php?action=register&register=1"


You also need the following in your custom registration code, inside the form itself:

Code:
<?php
    echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
?>


To have the function wp_create_nonce() available, you need to include pluggable.php.

Finally, you also need to supply your own Javascript form validation.

Whew!

Statistics: Posted by martonic — August 23rd, 2010, 5:00 pm


]]>
2010-08-23T15:36:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2525#p2525 <![CDATA[Re: Front End Registration and Login]]>
Jason Caldwell wrote:
Thanks for the great question.
or better, make it point to my Custom Registration Page?

Yes. Inside the functions.php file for your WordPress theme, you can add these lines:
Code:
<?php
add_action("init", "redirect_registrations"); function redirect_registrations()
    {
        if(preg_match("/wp-login\.php/", $_SERVER["REQUEST_URI"])
           && $_GET["action"] === "register")
            { header("Location: [YOUR CUSTOM URL HERE]"); exit(); }
    }
?>

Change the part that says: [YOUR CUSTOM URL HERE]


(EDITED)

Hi again Jason,

I did this, but the "custom registration page" does not work at all.

When submitted, it just resets the form to all blanks - and reloads the page. :(

It did work, until I added the "redirection code" above. Although that DOES make the registration link redirect - it also makes the custom registration page fall down. :(

Any suggestions? :?:

Statistics: Posted by martonic — August 23rd, 2010, 3:36 pm


]]>
2010-08-18T01:15:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2451#p2451 <![CDATA[Re: Front End Registration and Login]]> Statistics: Posted by Jason Caldwell — August 18th, 2010, 1:15 am


]]>
2010-08-12T02:14:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2273#p2273 <![CDATA[Re: Front End Registration and Login]]>
Code:
<?php
add_action("init", "redirect_registrations"); function redirect_registrations()
    {
        if(preg_match("/wp-login\.php/", $_SERVER["REQUEST_URI"])
           && $_GET["action"] === "register")
            { header("Location: [YOUR CUSTOM URL HERE]"); exit(); }
    }
add_action("init", "redirect_lostpassword"); function redirect_lostpassword()
    {
        if(preg_match("/wp-login\.php/", $_SERVER["REQUEST_URI"])
           && $_GET["action"] === "lostpassword")
            { header("Location: [YOUR CUSTOM URL HERE]"); exit(); }
    }
?>

Statistics: Posted by Guest — August 12th, 2010, 2:14 am


]]>
2010-08-10T12:11:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2249#p2249 <![CDATA[Re: Front End Registration and Login]]>

Statistics: Posted by martonic — August 10th, 2010, 12:11 pm


]]>
2010-08-05T13:46:33-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2131#p2131 <![CDATA[Re: Front End Registration and Login]]>

or better, make it point to my Custom Registration Page?

Yes. Inside the functions.php file for your WordPress theme, you can add these lines:
Code:
<?php
add_action("init", "redirect_registrations"); function redirect_registrations()
    {
        if(preg_match("/wp-login\.php/", $_SERVER["REQUEST_URI"])
           && $_GET["action"] === "register")
            { header("Location: [YOUR CUSTOM URL HERE]"); exit(); }
    }
?>

Change the part that says: [YOUR CUSTOM URL HERE]

Statistics: Posted by Jason Caldwell — August 5th, 2010, 1:46 pm


]]>
2010-08-03T13:51:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2039#p2039 <![CDATA[Custom Registration Page - a problem]]>
Jason Caldwell wrote:
Hi Henry. Thanks for the great question.

Here are two ways to accomplish this:

1. You can build a form into your theme, or into a specific Post or Page that you've created. Have that form submit all the same fields to: /wp-login.php?action=register ( this would give you additional control over the cosmetics ).


Hi Jason,

You can do this, but then the Login Page still has a "Register" link at the bottom, which leads to the "usual" registration page. :(

Is there a good way to get rid of that - or better, make it point to my Custom Registration Page? :?:

Statistics: Posted by martonic — August 3rd, 2010, 1:51 pm


]]>
2010-07-31T02:41:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=2000#p2000 <![CDATA[Re: Front End Registration and Login]]>
My goal is to have members stay on my site without having to view the WP dashboard so they don't have to go to wp-login.php, I want a seamless transition from registration to editing their user profile, having them stay on the front-end of the site to register and manage their account.

What hooks should I use to create such a form? Where would I find them?

Can I integrate your existing Edit User profile page without using an iframe?

Statistics: Posted by Guest — July 31st, 2010, 2:41 am


]]>
2010-07-28T07:06:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=1900#p1900 <![CDATA[Re: Front End Registration and Login]]>
Here are two ways to accomplish this:

1. You can build a form into your theme, or into a specific Post or Page that you've created. Have that form submit all the same fields to: /wp-login.php?action=register ( this would give you additional control over the cosmetics ).

2. You can upgrade to s2Member Pro. The s2Member Pro Module makes it possible for s2Member to use PayPal® Pro Forms ( instead of standard PayPal® Buttons ). PayPal® Pro Forms integrate seamlessly with WordPress® Shortcodes. This allows you to keep Customers on your site at all times, and it consolidates the Checkout / Registration steps into a single form that you can dress up just the way you like.

The s2Member Pro Module, also includes a Shortcode for each type of Form, even for free registrations, where no payment is required, for Level #0 access.


but, I want to protect my backend

Just to point out. The wp-login.php file is not part of the WordPress backend.
I realize that it is primarily intended for admin access ( by default, without s2Member ), but the /wp-login.php file resides outside the /wp-admin/ directory. So it IS safe to use that.

Statistics: Posted by Jason Caldwell — July 28th, 2010, 7:06 am


]]>
2010-07-25T03:46:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=441&p=1808#p1808 <![CDATA[Front End Registration and Login]]>
I know I could use .htaccess to mask wp-login.php but, I want to protect my backend and I want to have the registration and login process to be a part of my website so the transition is seamless. Is there a way to do this using WP/s2Member hook and filters?

Statistics: Posted by Guest — July 25th, 2010, 3:46 am


]]>