• Hi! I’d like to add user avatar on registration and profile page.
    Here’s how I create the fild, but I don’t know how can I save it in data base. Could you help me?

    <h3>Upload avatar</h3>
            <?php echo get_simple_local_avatar( $profileuser->ID ); ?>
            <?php
              if ( ! $upload_rights = current_user_can('upload_files') )
                $upload_rights = empty( $this->options['caps'] );
    
              if ( $upload_rights ) {
                do_action( 'simple_local_avatar_notices' );
                wp_nonce_field( 'simple_local_avatar_nonce', '_simple_local_avatar_nonce', false );
            ?>
    
            <p>
              <input type="file" name="simple-local-avatar" id="upload_hidden" onchange="document.getElementById('upload_visible').value = this.value;" />
              <button type="button" id="review" onclick="document.getElementById('upload_hidden').click();">Выбрать</button>
            </p>
    
                <p>
                  <?php if ( current_user_can( 'upload_files' ) && did_action( 'wp_enqueue_media' ) ) : ?><a href="#" class="button hide-if-no-js" id="simple-local-avatar-media"><?php _e( 'Choose from Media Library', 'simple-local-avatars' ); ?></a> ?<?php endif; ?>
    
                </p>
            <?php
              } else {
                if ( empty( $profileuser->simple_local_avatar ) )
                  echo '<span class="description">' . __('No local avatar is set. Set up your avatar at Gravatar.com.','simple-local-avatars') . '</span>';
                else
                  echo '<span class="description">' . __('You do not have media management permissions. To change your local avatar, contact the blog administrator.','simple-local-avatars') . '</span>';
              }
            ?>

    https://www.ads-software.com/plugins/theme-my-login/

  • The topic ‘How to add and save avatar on registration and profile page?’ is closed to new replies.