in the codepad link you can find what I am using to edit profile from the front-end. http://codepad.org/QJjDEA7p

The code is working (which I got from How to edit a user profile on the front end? and change some things for me to work correctly).

I have installed Simple Local Avatar plugin to allow avatar uploading, but how can I modify the code to have it also from the front-end ? I found these below, which I tested, showed the upload button, did not showed the current avatar and didn't let me to change it.

Thank you for your help on this.




There goes a 50 bounty for a working example. Unfortunately I can not get Bainternet's example to work that I tested with User Avatar plugin also, and I am really stuck with this issue can't finding the solution.

  • I have a similar project to work on in couple of day. I will let you know if i come up with something.
    – Sisir
    Aug 17, 2011 at 8:52
  • Has anyone ever come up with a solution for this? Nov 9, 2011 at 20:44

3 Answers 3


You only need to of these hooks show_user_profile to show the extra fields and personal_options_update to update, try:


/* Get user info. */

global $current_user, $wp_roles;

/* Load the registration file. */
require_once( ABSPATH . WPINC . '/registration.php' );

/* If profile was saved, update profile. */
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {

    /* Update user password. */
    if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
        if ( $_POST['pass1'] == $_POST['pass2'] )
            wp_update_user( array( 'ID' => $current_user->id, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
            $error = __('The passwords you entered do not match.  Your password was not updated.', 'profile');

    /* Update user information. */
    if ( !empty( $_POST['url'] ) )
        update_usermeta( $current_user->id, 'user_url', esc_url( $_POST['url'] ) );
    if ( !empty( $_POST['email'] ) )
        update_usermeta( $current_user->id, 'user_email', esc_attr( $_POST['email'] ) );
    if ( !empty( $_POST['first-name'] ) )
        update_usermeta( $current_user->id, 'first_name', esc_attr( $_POST['first-name'] ) );
    if ( !empty( $_POST['last-name'] ) )
        update_usermeta($current_user->id, 'last_name', esc_attr( $_POST['last-name'] ) );
    if ( !empty( $_POST['yim'] ) )
        update_usermeta($current_user->id, 'yim', esc_attr( $_POST['yim'] ) );
    if ( !empty( $_POST['description'] ) )
        update_usermeta( $current_user->id, 'description', esc_attr( $_POST['description'] ) );

    //extra fields (simple local avatars ....)
        do_action('personal_options_update', $current_user->id);

    /* Redirect so the page will show updated info. */
    if ( !$error ) {

header("Location: ".$_SERVER['PHP_SELF']);


        <div id="post-<?php the_ID(); ?>">
            <div class="entry-content entry">
                <?php the_content(); ?>
                <?php if ( !is_user_logged_in() ) : ?>
                        <p class="warning">
                            <?php _e('You must be logged in to edit your profile.', 'profile'); ?>
                        </p><!-- .warning -->
                <?php else : ?>
                    <?php if ( $error ) echo '<p class="error">' . $error . '</p>'; ?>
                    <form method="post" id="adduser" action="<?php the_permalink(); ?>">
                        <p class="form-username">
                            <label for="first-name"><?php _e('First Name', 'profile'); ?></label>
                            <input class="text-input" name="first-name" type="text" id="first-name" value="<?php the_author_meta( 'user_firstname', $current_user->id ); ?>" />
                        </p><!-- .form-username -->
                        <p class="form-username">
                            <label for="last-name"><?php _e('Last Name', 'profile'); ?></label>
                            <input class="text-input" name="last-name" type="text" id="last-name" value="<?php the_author_meta( 'user_lastname', $current_user->id ); ?>" />
                        </p><!-- .form-username -->
                        <p class="form-email">
                            <label for="email"><?php _e('E-mail *', 'profile'); ?></label>
                            <input class="text-input" name="email" type="text" id="email" value="<?php the_author_meta( 'user_email', $current_user->id ); ?>" />
                        </p><!-- .form-email -->
                        <p class="form-url">
                            <label for="url"><?php _e('Website', 'profile'); ?></label>
                            <input class="text-input" name="url" type="text" id="url" value="<?php the_author_meta( 'user_url', $current_user->id ); ?>" />
                        </p><!-- .form-url -->
                        <p class="form-yim">
                            <label for="yim">yahoo</label>
                            <input class="text-input" name="yim" type="text" id="yim" value="<?php the_author_meta( 'yim', $current_user->id ); ?>" />
                        </p><!-- .form-yim -->
                        <p class="form-password">
                            <label for="pass1"><?php _e('Password *', 'profile'); ?> </label>
                            <input class="text-input" name="pass1" type="password" id="pass1" />
                        </p><!-- .form-password -->
                        <p class="form-password">
                            <label for="pass2"><?php _e('Repeat Password *', 'profile'); ?></label>
                            <input class="text-input" name="pass2" type="password" id="pass2" />
                        </p><!-- .form-password -->
                        <p class="form-textarea">
                            <label for="description"><?php _e('Biographical Information', 'profile') ?></label>
                            <textarea name="description" id="description" rows="3" cols="50"><?php the_author_meta( 'description', $current_user->id ); ?></textarea>
                        </p><!-- .form-textarea -->
                        <?php do_action('show_user_profile',$current_user->id); ?>
                        <p class="form-submit">
                            <?php echo $referer; ?>
                            <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />
                            <?php wp_nonce_field( 'update-user' ) ?>
                            <input name="action" type="hidden" id="action" value="update-user" />
                        </p><!-- .form-submit -->
                    </form><!-- #adduser -->
                    <?php endif; ?>
                </div><!-- .entry-content -->
            </div><!-- .hentry .post -->
            <?php comments_template( '', true ); ?>
  • Hi, I pasted it but I get the same behavior like my question. It shows the mystery man, the upload button, did not showed the current avatar and didn't let me to change it. I am using Simple Local Avatar plugin
    – EnexoOnoma
    Aug 11, 2011 at 21:16
  • Try using this code with a plugin named user avatar
    – Bainternet
    Aug 11, 2011 at 21:45
  • Thank you for this, I tried it but I have the same effects like before. Also because of a reason, when I click on update it takes me to a page wp-admin/admin-ajax.php?action=user_avatar_add_photo&step=1&uid=&TB_iframe=true&width=720&heigh‌​t=450 that writes -1 and on remove it takes me to wp-admin/profile.php
    – EnexoOnoma
    Aug 12, 2011 at 0:49
  • I am hitting my head on the wall, I tried everything but still can't make it working..
    – EnexoOnoma
    Aug 12, 2011 at 15:40
  • Where are you getting the Ajax call from, paste a link
    – Bainternet
    Aug 12, 2011 at 16:19

Well maybe another approach will work. I've seen users profiles implemented and working on front-end somewhere using Theme My Login plugin ( http://wordpress.org/extend/plugins/theme-my-login/ ) and User Avatar ( http://wordpress.org/extend/plugins/user-avatar/ );

You can also find more here http://wordpress.org/support/topic/custom-edit-profile-page .

  • I came across this but I need to do it without using more plugins than avatar. I think that needs cimy user extra fields also to work.
    – EnexoOnoma
    Aug 15, 2011 at 11:37

Try this solution "Fask" did using user-photo plugin.

Scroll down and look for Fask's post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.