function wpua_action_show_user_profile($user)
        {
            global $blog_id, $current_user, $post, $show_avatars, $wpdb, $wpua_allow_upload, $wpua_edit_avatar, $wpua_upload_size_limit_with_units;
            // Get WPUA attachment ID
            $wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true);
            // Show remove button if WPUA is set
            $hide_remove = !has_wp_user_avatar($user->ID) ? ' wpua-hide' : "";
            // If avatars are enabled, get original avatar image or show blank
            $avatar_medium_src = (bool) $show_avatars == 1 ? wpua_get_avatar_original($user->user_email, 96) : includes_url() . 'images/blank.gif';
            // Check if user has wp_user_avatar, if not show image from above
            $avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src;
            // Check if user has wp_user_avatar, if not show image from above
            $avatar_thumbnail = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 96) : $avatar_medium_src;
            // Change text on message based on current user
            $profile = $current_user->ID == $user->ID ? '“' . __('Update Profile') . '”' : '“' . __('Update User') . '”';
            ?>
      <?php 
            do_action('wpua_before_avatar');
            ?>
      <input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php 
            echo $wpua;
            ?>
" />
      <?php 
            if (current_user_can('upload_files')) {
                // Button to launch Media uploader
                ?>
        <p id="wpua-add-button"><button type="button" class="button" id="wpua-add" name="wpua-add"><?php 
                _e('Edit Image');
                ?>
</button></p>
      <?php 
            } elseif (!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) {
                // Upload button
                ?>
        <p id="wpua-upload-button">
          <input name="wpua-file" id="wpua-file" type="file" />
          <button type="submit" class="button" id="wpua-upload" name="submit" value="<?php 
                _e('Upload');
                ?>
"><?php 
                _e('Upload');
                ?>
</button>
        </p>
        <p id="wpua-upload-messages">
          <span id="wpua-max-upload"><?php 
                printf(__('Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units), esc_html('KB'));
                ?>
</span>
          <span id="wpua-allowed-files"><?php 
                _e('Allowed Files');
                ?>
: <?php 
                _e('<code>jpg jpeg png gif</code>');
                ?>
</span>
        </p>
      <?php 
            } elseif ((bool) $wpua_edit_avatar == 1 && !current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) {
                // Edit button
                ?>
        <?php 
                $edit_attachment_link = add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php'));
                ?>
        <p id="wpua-edit-button"><button type="button" class="button" id="wpua-edit" name="wpua-edit" onclick="window.open('<?php 
                echo $edit_attachment_link;
                ?>
', '_self');"><?php 
                _e('Edit Image');
                ?>
</button></p>
      <?php 
            }
            ?>
      <?php 
            /*?>
              <p id="wpua-preview">
                <img src="<?php echo $avatar_medium; ?>" alt="" />
                <?php _e('Original Size'); ?>
              </p>
              <?php */
            ?>
      <p id="wpua-thumbnail">
        <img src="<?php 
            echo $avatar_thumbnail;
            ?>
" alt="" />
        <?php 
            _e('Thumbnail');
            ?>
      </p>
      <p id="wpua-remove-button"><button type="button" class="button<?php 
            echo $hide_remove;
            ?>
" id="wpua-remove" name="wpua-remove"><?php 
            _e('Remove');
            ?>
</button></p>
      <p id="wpua-message"><?php 
            printf(__('Click %s to save your changes', 'wp-user-avatar'), $profile);
            ?>
</p>
      <?php 
            do_action('wpua_after_avatar');
            ?>
    <?php 
        }
        function wpua_action_show_user_profile($user)
        {
            global $wpdb, $blog_id, $current_user, $show_avatars;
            // Get WPUA attachment ID
            $wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id) . 'user_avatar', true);
            // Show remove button if WPUA is set
            $hide_notice = has_wp_user_avatar($user->ID) ? ' class="hide-me"' : '';
            $hide_remove = !has_wp_user_avatar($user->ID) ? ' hide-me' : '';
            // If avatars are enabled, get original avatar image or show blank
            $avatar_medium_src = $show_avatars == '1' && is_admin() ? wpua_get_avatar_original($user->user_email, 96) : includes_url() . 'images/blank.gif';
            // Check if user has wp_user_avatar, if not show image from above
            $avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src;
            // Check if user has wp_user_avatar, if not show image from above
            $avatar_thumbnail = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 96) : $avatar_medium_src;
            // Change text on message based on current user
            $profile = $current_user->ID == $user->ID ? 'Profile' : 'User';
            // Max upload size
            if (!function_exists('wp_max_upload_size')) {
                require_once ABSPATH . 'wp-admin/includes/template.php';
            }
            $upload_size_unit = wp_max_upload_size();
            $byte_sizes = array('KB', 'MB', 'GB');
            for ($u = -1; $upload_size_unit > 1024 && $u < count($byte_sizes) - 1; $u++) {
                $upload_size_unit /= 1024;
            }
            if ($u < 0) {
                $upload_size_unit = 0;
                $u = 0;
            } else {
                $upload_size_unit = (int) $upload_size_unit;
            }
            ?>
      <?php 
            if (class_exists('bbPress') && !is_admin()) {
                // Add to bbPress profile with same style
                ?>
        <h2 class="entry-title"><?php 
                _e('WP User Avatar');
                ?>
</h2>
        <fieldset class="bbp-form">
          <legend><?php 
                _e('WP User Avatar');
                ?>
</legend>
      <?php 
            } else {
                // Add to profile with admin style
                ?>
        <h3><?php 
                _e('WP User Avatar');
                ?>
</h3>
        <table class="form-table">
          <tr>
            <th><label for="wp_user_avatar"><?php 
                _e('WP User Avatar');
                ?>
</label></th>
            <td>
      <?php 
            }
            ?>
      <input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php 
            echo $wpua;
            ?>
" />
      <?php 
            if (current_user_can('upload_files')) {
                // Button to launch Media uploader
                ?>
        <p><button type="button" class="button" id="add-wp-user-avatar" name="add-wp-user-avatar"><?php 
                _e('Edit WP User Avatar');
                ?>
</button></p>
      <?php 
            } elseif (!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) {
                // Upload button
                ?>
        <input name="wp-user-avatar-file" id="wp-user-avatar-file" type="file" />
         <button type="submit" class="button" id="upload-wp-user-avatar" name="upload-wp-user-avatar" value="<?php 
                _e('Upload');
                ?>
"><?php 
                _e('Upload');
                ?>
</button>
        <?php 
                if (isset($_GET['errors']) && $_GET['errors'] == 'type') {
                    ?>
          <p id="wp-user-avatar-errors"><?php 
                    _e('File format is not allowed.');
                    ?>
</p>
        <?php 
                }
                ?>
        <?php 
                $postdata = file_get_contents("php://input");
                if (!empty($postdata['wp-user-avatar-file'])) {
                    ?>
          <p id="wp-user-avatar-errors"><?php 
                    _e('File is too large.');
                    ?>
</p>
        <?php 
                }
                ?>
        <p>
          <?php 
                _e('Maximum upload file size: ' . esc_html($upload_size_unit) . esc_html($byte_sizes[$u]));
                ?>
          <br />
          <?php 
                _e('Allowed file formats: JPG, GIF, PNG');
                ?>
        </p>
      <?php 
            } elseif (!current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) {
                // Edit button
                ?>
        <?php 
                $edit_attachment_link = function_exists('wp_enqueue_media') ? add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')) : add_query_arg(array('attachment_id' => $wpua, 'action' => 'edit'), admin_url('media.php'));
                ?>
        <p><button type="button" class="button" id="edit-wp-user-avatar" name="edit-wp-user-avatar" onclick="window.open('<?php 
                echo $edit_attachment_link;
                ?>
', '_self');"><?php 
                _e('Edit WP User Avatar');
                ?>
</button></p>
      <?php 
            }
            ?>
      <p id="wp-user-avatar-preview">
        <img src="<?php 
            echo $avatar_medium;
            ?>
" alt="" />
        <?php 
            _e('Original');
            ?>
      </p>
      <p id="wp-user-avatar-thumbnail">
        <img src="<?php 
            echo $avatar_thumbnail;
            ?>
" alt="" />
        <?php 
            _e('Thumbnail');
            ?>
      </p>
      <p><button type="button" class="button<?php 
            echo $hide_remove;
            ?>
" id="remove-wp-user-avatar" name="remove-wp-user-avatar"><?php 
            _e('Remove');
            ?>
</button></p>
      <p id="wp-user-avatar-message"><?php 
            _e('Press "Update ' . $profile . '" to save your changes.');
            ?>
</p>
      <?php 
            if (class_exists('bbPress') && !is_admin()) {
                // Add to bbPress profile with same style
                ?>
        </fieldset>
      <?php 
            } else {
                // Add to profile with admin style
                ?>
            </td>
          </tr>
        </table>
      <?php 
            }
            ?>
      <?php 
            echo wpua_js($user->display_name, $avatar_medium_src);
            // Add JS
            ?>
      <?php 
        }