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.

Registration Form Fields: (Front-end Registration)

Username,
Email (password will generate to email).

Edit Profile: (Front-end Edit Profile)

Firstname,
Lastname,
Username,
Email,
Phone, 
Address,
Zip / postal code,
Website,
State(Drop down-Dynamic),
Country(Drop down), 
Newsletter (Check box),
Change password.

The above fields are required for their corresponding pages.

Currently, i am using Theme My Login Plugin for Front-end Login and Registration.

and, Cimy User Extra Fields Plugin for Registration page fields editing. (but, it has no option for adding fields and changing fields in profile page.)

How can we do this by using Custom code editing or Plugin?

If there is any plugin to do this, tell me the Plugin name and Download links.

If it is possible only by Custom code editing, please guide me how to complete this.

share|improve this question

3 Answers 3

To add or remove contact fields, add this to your functions.php:

    <?php
    add_filter('user_contactmethods', 'modify_contact_methods');
    function modify_contact_methods($profile_fields) {
        // Add new fields
    $profile_fields['facebook'] = 'Facebook URL';
    $profile_fields['twitter'] = 'Twitter Username';
    $profile_fields['gplus'] = 'Google+ URL';
    $profile_fields['youtube'] = 'YouTube Channel URL';

    // Remove old fields
    unset($profile_fields['aim']);
    unset($profile_fields['yim']);
    unset($profile_fields['jabber']);

    return $profile_fields;
    }
    ?>

To remove username (and other fields or headers), use jQuery:

<?php
add_action('admin_head','hide_personal_options');
function hide_personal_options() { ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) { 
    $('#your-profile > h3').hide(); // removes all headers
    $('#your-profile > table:first').hide(); // remove the entire Personal Options table
    $("#nickname,#display_name,#user_login,#url").parent().parent().remove();  // remove nickname, display name, username, website fields, etc.
    });
    </script>
<?php
}
?>
share|improve this answer

And if you want to remove some fields you just unset it like this:

function my_new_contactmethods( $contactmethods ) {
     // Remove Yahoo IM
     unset( $contactmethods['yim'] );

    return $contactmethods;
}
add_filter('user_contactmethods','remove_new_contactmethods',10,1);
share|improve this answer

This answer is copied from the best post over this topic! I could've just given you the links, but that would get me a comment from the mod to post sample code ;)

For adding the fields:

add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );

function my_show_extra_profile_fields( $user ) { ?>
    <h3>Extra profile information</h3>
    <table class="form-table">
        <tr>
            <th><label for="twitter">Twitter</label></th>
            <td>
                <input type="text" name="twitter" id="twitter" value="<?php echo esc_attr( get_the_author_meta( 'twitter', $user->ID ) ); ?>" class="regular-text" /><br />
                <span class="description">Please enter your Twitter username.</span>
            </td>
        </tr>
    </table>

And for saving the data:

add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );

function my_save_extra_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) )
        return false;

    /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
    update_usermeta( $user_id, 'twitter', $_POST['twitter'] );
}

Another helpful link here.

Thank You Justin Tadlock! :D

share|improve this answer

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.