Here’s a WordPress plugin that will allow you to customize the user registration fields through extra hooks.
Download Custom User Registration plugin Download from WordPress
As taken from the readme file:
Description
Customize the user registration page with additional validated fields. Hooks right into existing parts of the registration process.
Provides a number of hooks to allow further customization: fields, validation, email header/message/template, custom signup url (if used with other plugins like BuddyPress).
Works with anything using the regular WP register hooks, like BuddyPress and Prospress.
Installation
- Upload plugin folder
custom-user-accessto your plugins directory (/wp-content/plugins/) - Activate plugin
- Go to new admin page User Login – ABT and change the registration url, if needed.
Please note that this includes an instance of Singleton and WP_Options_page, both taken from the WP-Dev-Library plugin, so if you are also using that plugin please be aware of potential conflicts. This plugin checks for the existance of those classes before including files, so if you experience any issues you can remove those lines.
Frequently Asked Questions
How do I add extra fields?
- Use the hook
abt_custom_register_fields. Append or replace items in the$fieldsarray with an array of attributes. - Specify validation with
data-validation. See plugin file for examples of password and name fields. - Make sure that, if you’re providing default WP fields, that the field names are correct.
function YOUR_register_fields($fields){
$fields []= array('name'=>'user_url', 'type'=>'text', 'class'=>'input url', 'size'=>20, 'label'=>'Your Website', 'data-validation'=>'url');
$fields []= array('name'=>'aim', 'type'=>'text', 'class'=>'input social-client', 'size'=>20, 'label'=>'AIM', 'data-validation'=>'alphanumeric');
// set name required
$fields[3]['data-validation'] = array('required', 'string');
return $fields;
}
add_filter('abt_custom_register_fields', 'YOUR_register_fields');
How do I change the email?
** Headers **:
function YOUR_register_email_headers($headers){
$headers []= 'Bcc:youremail@domain.com';
return $headers;
}
add_filter('abt_custom_register_email_headers', 'YOUR_register_email_headers');
** Template **: Just copy email-signup.tpl.php from the plugin folder to your theme folder. Or use the hook abt_custom_login_email_templates.
How do I customize my thank-you message?
On your custom thank-you page, add something like the following:
// check if we had a successful signup - indicated by a notification in session
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL;
if( false !== strpos($referer, 'action=register')
|| (
true === ABT_Custom_User_Access::flash_var('notification')
)){
?>
<p>Thank you for registering! Please check your email for a confirmation message.</p>
<?php
// clear the flash message
ABT_Custom_User_Access::flash_var(false);
}
Hooks
abt_custom_login_nometadetermine which fields are not treated as usermeta, but instead directly on user table format: pipe-separated, default ='|user_url|display_name|'abt_custom_login_fieldsadd or remove additional login fieldsabt_custom_login_extra_validationapply extra validation, return whether it has errors or not – uses $has_errors, $key, $attr, $postabt_custom_login_has_errorsdo something with the errors instead of saving the fieldabt_custom_login_email_templatesadjust default template namesabt_custom_login_email_headerschange default email headersabt_custom_login_email_messagechange email message before it’s sent to userabt_custom_register_urlchange where the form redirects to on error; not completely working, so please rely on the admin option instead.abt_custom_register_admin_settingsadd more admin settings (usingWP_Options_Pageclass)
