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 developing a WordPress plugin and I want to append some extra form fields in add new form of Users section inside admin panel without editing core files. Can somebody help me in achieving this.

share|improve this question
add comment

2 Answers

You will find a lot of tutorials for doing this, take a look here for example : http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields

You can use following hooks : show_user_profile, edit_user_profile, personal_options_update, edit_user_profile_update ...

EDIT : But it will not add fields on the "New User" form since there is no hook for that : http://core.trac.wordpress.org/browser/branches/3.3/wp-admin/user-new.php

But you can :

  • try to add needed fields using javascript, and use user_register hook to add user meta data in db.
  • Or build your own form.
share|improve this answer
    
I want to add form fields on new user registration form i.e on "add new" page of users section. The link only shows how to add such functionality on "edit-user" and "your profile" page of users section. –  Krishna Apr 19 '12 at 8:35
    
Sorry, answer updated. –  soju Apr 19 '12 at 8:51
    
please don't answer just because you have to. read the question properly. –  Hasin Hayder Oct 2 '12 at 3:27
    
Please don't comment if you don't have any useful information to give. –  soju Oct 2 '12 at 6:41
2  
That's the point of this site, to ask, to answer. Sometimes we make mistakes. That's what down-voting is for, in cases where bad advice/incorrect answers are given, assuming the user doesn't make the effort to correct his/her answer. But without genuine contributions from users this resource doesn't exist. Point in case, if Soju didn't answer this question, it'd still be unanswered. Now who does that help? –  userabuser Oct 29 '12 at 14:41
add comment

You can use

apply_filters('show_password_fields', true) )
add_filter('show_password_fields','youfunction',10,1);
function youfunction($return)
{
    ?>
    <tr>
                    <th><label for="gender">Gender</label></th>
                    <td>

                        <label><input type="radio" name="w4p_user_gender"  value="male" class="regular-radio"  />Male</label>
                        <label style="margin-left:10px"><input type="radio" name="w4p_user_gender"  value="female" class="regular-radio"  />Female</label><br/>
                        <span class="description">Please select your Gender.</span>
                    </td>
                </tr>
    <?php
    return $return;
}

this filter to add your fields. I don't know it's is a good idea or not but works for me :).

share|improve this answer
    
But, does this works for custom user meta? As far as I tested, only for default user meta... Are you doing something like this? –  brasofilo Dec 5 '12 at 15:53
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.