WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have customised the worpress registration page by adding new fields using the Cimy User Extra Fields plugin so my site is now fine for allowing users to register as contributors.

I now want to create a different link to allow registrations as subscribers but with different fields displaying on the registration form.

What is the best way to do this? Another plugin? PHP functions?


share|improve this question
Take a look at this wordpress.stackexchange.com/questions/15954/… – Bainternet Mar 24 '13 at 19:03

I don't know how "Cimy User Extra Fields" works, but you can add fields to the user registration page with:

function extra_user_profile_fields_wpse_92164() {
  echo '<label for="extra_field">',_("Extra Field").'</label>';
  echo '<input type="text" name="extra_field" value="" size="25" id="extra_field" />';
add_action( 'register_form', 'extra_user_profile_fields_wpse_92164' );

To switch subscriber types you could pass in $_GET parameters, which is how the default wp-login.php forms works. So...

function extra_user_profile_fields() {
  if (!isset($_GET['utype'])) return false;
  echo '<input type="hidden" name="register_as" value="'.esc_attr($_GET['utype']).'" />';
  if ('subscriber' == $_GET['utype']) {
    echo '<label for="extra_field_sub">',_("Extra Field Subscriber").'</label>';
    echo '<input type="text" name="extra_field_sub" value="" size="25" id="extra_field_sub" />';
  } else {
    echo '<label for="extra_field">',_("Extra Field").'</label>';
    echo '<input type="text" name="extra_field" value="" size="25" id="extra_field" />';
add_action( 'register_form', 'extra_user_profile_fields' );

Now you can pass data to the form like: http://example.com/wp-login.php?action=register&utype=subscriber

You can then save the date pretty much as demonstrated in the Codex for the user_register hook.

 function myplugin_registration_save($user_id) {

    if ( isset( $_POST['extra_field'] ) ) {
      update_user_meta($user_id, 'extra_field', $_POST['extra_field']);

    if ( isset( $_POST['extra_field_sub'] ) ) {
      update_user_meta($user_id, 'extra_field_sub', $_POST['extra_field_sub']);

    // alter the user Role
    if ('subscriber' == $_POST['register_as'] || 'contributor' == $_POST['register_as']) { 
add_action('user_register', 'myplugin_registration_save');


Consider this code 'beta'. I wrote the function to only allow role changes to 'contributor' or 'subscriber' which are low-permission roles, but the function could stand better data validation before being put into service.

share|improve this answer
how does that tell it to create the user as a subscriber rather than the default setting of contributor? – Sean Hawkins Mar 24 '13 at 19:42
LOl... you are right. You could parse the extra fields and infer that but I should have included a hidden field. I'll edit things. – s_ha_dum Mar 24 '13 at 19:44
also...what would then happen if the example.com/wp-login.php?action=register page was accessed without adding one of the &utype=subscriber or example.com/wp-login.php?action=register&utype=contributor? Which fields would show? Neither? That would be a problem... – Sean Hawkins Mar 24 '13 at 19:56
On my system, the default form appears and the user is registered as a subscriber. "Cimy" may have changed that for you. – s_ha_dum Mar 24 '13 at 20:18
yeah I follow that, that's great. How would validation checks work/affect the form submission? – Sean Hawkins Mar 24 '13 at 20:23

Your Answer


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.