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™
but, I want to protect my backend
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 ).
or better, make it point to my Custom Registration Page?
<?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(); }
}
?>
<?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(); }
}
?>
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: Select all
<?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]
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(); }
&& $_GET["register"] !== "1"
action="/wp-login.php?action=register®ister=1"
<?php
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
?>
$id = wp_create_user(login, pass, email)
wp_new_user_notification($id, pass)
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".
Users browsing this forum: Exabot [Bot] and 4 guests