/**
 * Add the default user profile metaboxes
 *
 * @since 0.1.0
 *
 * @param   string  $type
 * @param   mixed   $user
 */
function wp_user_profiles_add_avatar_meta_box($type = '', $user = null)
{
    // Bail if no profile sections
    if (!function_exists('wp_user_profiles_sections')) {
        return;
    }
    // Support for WP User Profiles 0.1.7 and higher
    if (function_exists('wp_user_profiles_get_section_hooknames')) {
        $types = wp_user_profiles_get_section_hooknames();
        // WP User Profiles 0.1.6 and lower
    } else {
        $types = wp_user_avatars_profile_sections();
    }
    // Bail if not user metaboxes
    if (empty($user) || !in_array($type, $types, true)) {
        return;
    }
    // Register avatar metabox
    add_meta_box('user-avatar', _x('Avatar', 'users user-admin edit screen', 'wp-user-avatars'), 'wp_user_profiles_avatar_metabox', $type, 'side', 'low');
}
/**
 * Add scripts to the profile editing page
 *
 * @param string $hook_suffix Page hook
 */
function wp_user_avatars_admin_enqueue_scripts($hook_suffix = '')
{
    // Bail if not profile screen
    if (!in_array($hook_suffix, wp_user_avatars_profile_sections())) {
        return;
    }
    // Maybe enqueue media
    if (current_user_can('upload_avatars')) {
        wp_enqueue_media();
    }
    // User ID
    $user_id = !empty($_GET['user_id']) ? (int) $_GET['user_id'] : get_current_user_id();
    // URL & Version
    $url = wp_user_avatars_get_plugin_url();
    $ver = wp_user_avatars_get_asset_version();
    // Enqueue
    wp_enqueue_script('wp-user-avatars', $url . 'assets/js/user-avatars.js', array('jquery'), $ver, true);
    wp_enqueue_style('wp-user-avatars', $url . 'assets/css/user-avatars.css', array(), $ver, false);
    // Localize
    wp_localize_script('wp-user-avatars', 'i10n_WPUserAvatars', array('insertMediaTitle' => esc_html__('Choose an Avatar', 'wp-user-avatars'), 'insertIntoPost' => esc_html__('Set as avatar', 'wp-user-avatars'), 'deleteNonce' => wp_create_nonce('remove_wp_user_avatars_nonce'), 'mediaNonce' => wp_create_nonce('assign_wp_user_avatars_nonce'), 'user_id' => $user_id));
}