Registration Forms: What’s New in 1.5

Last week I released version 1.5 of my Simplr Registration Forms plugin. The new version includes some big fixes and requested features. Particularly, this version now supports WP Multisite and has a few addition profile fields that can be added to the default form. It also includes better security, via WP nonces, and better field validation.

But the most important change is that it includes hooks and filters that allow it to be extended by you, the user.

For instance, let’s add a field to our form that requests the user’s zip code. First, in your functions.php file create a function for displaying the field:

function sample_zip_field($form) {
 $form .=  '<div>';
 $form .=  '<label for="zip">Zip Code:</label>';
 $form .=  '<input type="text" name="zip" value="'.$_POST['zip'] .'"/><br/>';
 $form .=  '</div>';
 return $form;
}

Note that this function receives the parameter $form and then returns $form. Failing to return the form will make the entire registration form disappear. To add this form to the registration use:

add_filter('simplr_add_form_fields', 'sample_zip_field');

But then we also need to make sure this data gets saved when the for gets saved. So you’ll need to create a function for that as well.

function sample_save_meta($user_id) {
if(isset($_POST['zip'])) {
 add_user_meta($user_id, 'user_zip', $_POST['zip']);
 }
return $user_id;
}

Note that in order for this function to work properly it has to receive the $user_id. It is also good practice to return the $user_id at the end of the function, though not necessary.

To make sure your save function is called use the hook:

add_action('simplr_profile_save_meta','sample_save_meta');

With these two “hooks”, you can customize the registration form however you want. You could even set up your field function to only display on certain pages, making it form-specific.

Finally, I’ve also added filters to the labels on the default form fields so you can change them at will. For instance, to change username to “screen name” use the following.

function sample_label_username($label) {
 $label = "Screen name: ";
 return $label;
}
add_filter('simplr_label_username','sample_label_username');

I hope you find the changes useful.

About Mike Van Winkle

Ugh. I hate writing profiles. Just read the blog dude.

Comments

  1. Localpaper says:

    Mike, thank you for your post. I have a question, following you description for this plug in users, can register as a teacher or student, etc. I wanted to know if there was a way, or some suggestions in having different registration inquiries based on the user specific role (Teacher/Student)

    Thanks!

  2. Ibby says:

    Hey there. Does this version support creating a password field so users are able to create their own password instead of a random generated?

  3. Masrule says:

    Hi Mike,

    Thanks for your great plugin. How I can put the registration form from other website?

    I have a landing page that doing well in search engine. This landing page are from other website. I want to put the registration form at this landing page.

  4. Nicole says:

    Hi

    Is it possible to make the custom fields required fields when registering?

    Thanks

  5. Thomas says:

    Hi, thanks for making this plugin. However, I am very new to PHP etc. and much of this went over my head. Do you have any plans on adding a settings panel?

  6. Ryan says:

    How about that first question:

    “I wanted to know if there was a way, or some suggestions in having different registration inquiries based on the user specific role?”

    Can we do this?

    Thanks in advance for any info,
    R

  7. david says:

    Hi, this is a great Plugin and explanation. I would use it but I need also a “Edit Profile page”. I thinks that would complete your software for its purposes of having a front end for the users.

    Do you have any tips about that?
    Or can you make a job quotation for this need? I would hire you if you are available.

    Thanks, david

  8. Sodhan Manandhar says:

    ;Hey mike,
    Is there any way i can group my fields ?

    General
    Usernmae Passwword

    Other Information
    Addresss Zip PostCode

    Extra Information
    Hobbies Fav team

  9. ovi says:

    Hi Mike!
    Thanks for your great plugin.
    I’m creating a multisite and I want to use your plugin.
    The problem is that I added the shortcode into the home page but can’t see how to register not only the new user, but also the new site in the multisite network.
    So, what I want is this:
    1. In the registration page the user to be able to add/create a new site+user attached to that site and the user fields to modify by my needs.

    I need help doing this…
    Thanks

  10. Joanne says:

    Hi Mike
    Is the plugin compatible with WordPress v3.4.1? I urgently need a registration form, this sounds like what I need, but only if its compatible.
    Thanks

  11. Elizaaaspo says:
  12. CesElefsdef says:
  13. turldodwdf says:
  14. Carminruic says:
  15. kiperostoo says:
  16. Abbottdsf says:
  17. beatsoutqrv says:
  18. promopronet says:
  19. guan2rymw says:
  20. ponkmanv138 says:
  21. ythtgefenhnt says:
  22. ythtgefenhnt says:
  23. Unloneeexappy says:
  24. ythtgefenhnt says:
  25. Unipliff says:
  26. Coegop says:
  27. Coegop says:
  28. Coegop says:
  29. emelia says:

Speak Your Mind

*