Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm looking for an easy way to place the user registration form on the front-end of a WordPress site. I've already used wp_login_form() to place the login form on the front end, but now I need to do the same with the signup form.

Any ideas?

share|improve this question
add comment

7 Answers 7

up vote 6 down vote accepted

Jeff Starr wrote a great tutorial on front-end registration, login and password recovery
taking the similar approach as suggested by onetrickpony. So take this as a follow up to his answer and as another resource that might help you get it done:
http://digwp.com/2010/12/login-register-password-code/

Now you have two examples how to code this yourself and trust me - it's definitely worth doing it this (your own) way. It's not that hard and it gives you freedom, flexibility and reusability that no plugin can offer.

share|improve this answer
add comment

Gravity Forms is the best contact form plugin for WordPress, IMO. There newest version, in beta, has a user registration add-on. I have tried it and it works great. It will cost you though...it is $199 for a developer license.

Pricing page http://www.gravityforms.com/purchase-gravity-forms/

Blog post talking about the user registration add-on http://www.gravityhelp.com/

I highly recommend this plugin to the WordPress community.

Detailed Specifications:

Here are some of the features of the User Registration Add-On:

  • User Registration – Setup a form to register a user by mapping your form fields to available user registration fields in WordPress.
  • User Meta – Easily populate user meta data such as bio, instant messaging id, first name, last name as well as custom user meta to suit your needs.
  • BuddyPress Integration – Populate BuddyPress profile field data as part of the user registration process. Currently works with BuddyPress v1.2.6.
  • Payment Integration – Require a payment before user registration occurs. Includes support for PayPal subscriptions, and changing the user role or deleting the user if the subscription is canceled.
  • Password Field – The User Registration Add-On adds a Password field to Gravity Forms for use in your forms. The Password field includes a confirmation option, as well as a built in password strength checker option.
  • Post Author – Integrate the User Registration Add-On and Post Creation on a single form so that the author of the post that is created is the user registered by the add-on.
  • Site Creation – Automatically create a site on a WordPress network (multi-site) install and assign the newly created users as the Administrator for the site.
share|improve this answer
add comment

Try the simplemodal login plugin. It allows registration and login (You have to enable user registration), and it's got a very nice look to it.

share|improve this answer
    
Close, but not quite what I need. I need something that I can drop into my existing template. –  Pippin Jan 17 '11 at 23:07
    
Yeah.. I.. How can you not put that into your template? –  Lynne Jan 17 '11 at 23:19
    
Here's a site I just got done designing using simplemodal log in.. purevapes.com note the register and login links at the top. User is never taken away from front-end of the blog. You can incorporate them using simple HTML code in your template, and they redirect user to front page instead of admin panel. So I'm not sure how this can't be 'dropped' into any template. –  Lynne Jan 17 '11 at 23:22
    
I meant "dropped" in as in included in the actual page, not as a modal window. Here's the plugin I just found to do it: wordpress.org/extend/plugins/simplr-registration-form –  Pippin Jan 18 '11 at 3:02
    
Ah, I see. It didn't even cross my mind that the modal window would present a problem, but I can see now where there's a place for it and not. Thanks for the plugin link, throwing that in my arsenal. Glad you found your answer :) –  Lynne Jan 18 '11 at 3:05
add comment

in case you want to handle this yourself, here's what I use:

add_action('template_redirect', 'register_a_user');
function register_a_user(){
  if(isset($_GET['do']) && $_GET['do'] == 'register'):
    $errors = array();
    if(empty($_POST['user']) || empty($_POST['email'])) $errors[] = 'provide a user and email';
    if(!empty($_POST['spam'])) $errors[] = 'gtfo spammer';

    $user_login = esc_attr($_POST['user']);
    $user_email = esc_attr($_POST['email']);
    require_once(ABSPATH.WPINC.'/registration.php');

    $sanitized_user_login = sanitize_user($user_login);
    $user_email = apply_filters('user_registration_email', $user_email);

    if(!is_email($user_email)) $errors[] = 'invalid e-mail';
    elseif(email_exists($user_email)) $errors[] = 'this email is already registered, bla bla...';

    if(empty($sanitized_user_login) || !validate_username($user_login)) $errors[] = 'invalid user name';
    elseif(username_exists($sanitized_user_login)) $errors[] = 'user name already exists';

    if(empty($errors)):
      $user_pass = wp_generate_password();
      $user_id = wp_create_user($sanitized_user_login, $user_pass, $user_email);

      if(!$user_id):
        $errors[] = 'registration failed...';
      else:
        update_user_option($user_id, 'default_password_nag', true, true);
        wp_new_user_notification($user_id, $user_pass);
      endif;
    endif;

    if(!empty($errors)) define('REGISTRATION_ERROR', serialize($errors));
    else define('REGISTERED_A_USER', $user_email);
  endif;
}

the code is almost identical to the one from the user signup page.

then add your form in your template:

<?php
  if(defined('REGISTRATION_ERROR'))
    foreach(unserialize(REGISTRATION_ERROR) as $error)
      echo "<div class=\"error\">{$error}</div>";
  // errors here, if any

  elseif(defined('REGISTERED_A_USER'))
    echo 'a email has been sent to '.REGISTERED_A_USER;
?>
<form method="post" action="<?php echo add_query_arg('do', 'register', home_url('/')); ?>">
  <label>
    User:
    <input type="text" name="user" value=""/>
  </label>

  <label>
    Email:
   <input type="text" name="email" value="" />
  </label>

  <label>
    Delete this text:
   <input type="text" name="spam" value="some_crappy_spam_protection" />
  </label>

  <input type="submit" value="register" />
</form>

you can either create a widget with this, a shortcode or just the usual page template...

share|improve this answer
    
Looks great, though didn't seem to work. I've found a plugin that works great though, so thanks for the help. –  Pippin Jan 18 '11 at 3:13
    
works for me, but I think you need to change home_url() with the current page url because my code assumes the form is on the homepage. I've posted a get_current_page_url() function here on another question, don't remember which one though –  onetrickpony Jan 18 '11 at 3:21
add comment

You may use Theme My Login plugin

share|improve this answer
    
Looks like your plugin might work great, except that I can't get the register form to work. The login form displays fine, but when I try to go to the register form, it just takes me to the default wordpress one. Is there a way to just display the register form in the page? –  Pippin Jan 17 '11 at 23:14
    
Thats not my plugin I wrote :P –  Tareq Jan 19 '11 at 10:34
add comment

Here's a nice and easy way I've done this:

Copy the field names and any other stuff from the current Wordpress registration form. Make sure your custom form has the same name fields including hidden ones and then merely point the form action to the proper registration url: http://www.yourblog.com/wp-login.php?action=register - You then might want to change how the form redirects after registration as well if you don't like how it is handled.

There is also this plugin called Insite Login which allows you to drop in the registration form, login form and others into pages on your site: http://wordpress.org/extend/plugins/insitelogin/

The first solution should do what you want it to do though.

share|improve this answer
add comment

In case you need more fields on your registration form you can use the Profile Builder plugin

It lets you customize your website by adding front-end forms for login, register and edit-profile through the use of shortcodes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.