<h3>Загрузка аватарки</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>';
}
?>
<?php }
add_action( 'show_user_profile', 'show_profile_fields' );
add_action( 'edit_user_profile', 'show_profile_fields' );
//Save User Team option
function save_profile_fields( $user_id ) {
if (!current_user_can('edit_user', $user_id ))
return false;
update_user_meta( $user_id, 'squad', $_POST['squad'] );
update_user_meta( $user_id, 'facility', $_POST['facility'] );
}
add_action( 'personal_options_update', 'save_profile_fields' );
add_action( 'edit_user_profile_update', 'save_profile_fields' );