?>

<div class="sc">
    <h1 class="sc__title">Redactie</h1>
    <div class="redactie__container">
        <?php 
global $wpdb;
$blog_id = get_current_blog_id();
$wp_user_query = new WP_User_Query(array('meta_query' => array('relation' => 'OR', array('key' => $wpdb->get_blog_prefix($blog_id) . 'capabilities', 'value' => 'author', 'compare' => 'like'), array('key' => $wpdb->get_blog_prefix($blog_id) . 'capabilities', 'value' => 'editor', 'compare' => 'like'))));
$authors = $wp_user_query->get_results();
if (!empty($authors)) {
    foreach ($authors as $author) {
        $author_info = get_userdata($author->ID);
        $attachment_id = get_user_meta($author->ID, 'avatar_manager_custom_avatar', true);
        $custom_avatar = get_post_meta($attachment_id, '_avatar_manager_custom_avatar', true);
        $avatar_url = avatar_manager_generate_avatar_url($attachment_id, 300);
        ?>
            <div class="redactie__member">
                <div class="redactie__member-meta" onclick="">
                    <div>
                        <h3 class="redactie__member-title"><?php 
        echo $author->display_name;
        ?>
</h3>
                        <p class="redactie__member-summery">
                        <?php 
        echo limit_text($author->description, 35);
        ?>
                        </p>
                    </div>
                </div>
示例#2
0
/**
 * Returns user custom avatar based on user ID.
 *
 * @uses get_option() For getting values for a named option.
 * @uses avatar_manager_get_options() For retrieving plugin options.
 * @uses get_userdata() For retrieving user data by user ID.
 * @uses is_ssl() For checking if SSL is being used.
 * @uses add_query_arg() For retrieving a modified URL (with) query string.
 * @uses esc_attr() For escaping HTML attributes.
 * @uses get_user_meta() For retrieving user meta fields.
 * @uses is_multisite() For determining whether Multisite support is enabled.
 * @uses switch_to_blog() For switching the current blog to a different blog.
 * @uses get_post_meta() For retrieving attachment meta fields.
 * @uses avatar_manager_resize_avatar() For generating a resized copy of the
 * specified avatar image.
 * @uses update_post_meta() For updating attachment meta fields.
 * @uses avatar_manager_generate_avatar_url() For generating a full URI of an
 * avatar image based on attachment ID and size.
 * @uses restore_current_blog() For restoring the current blog.
 * @uses apply_filters() For calling the functions added to a filter hook.
 *
 * @since Avatar Manager 1.0.0
 *
 * @param int $user_id ID of the user.
 * @param int $size Size of the avatar image.
 * @param string $default URL to a default image to use if no avatar is
 * available.
 * @param string $alt Alternative text to use in image tag. Defaults to blank.
 * @return string <img> tag for the user's avatar.
 */
function avatar_manager_get_custom_avatar($user_id, $size = '', $default = '', $alt = false)
{
    // Returns if showing avatars is not enabled.
    if (!get_option('show_avatars')) {
        return false;
    }
    // Retrieves plugin options.
    $options = avatar_manager_get_options();
    if (empty($size) || !is_numeric($size)) {
        $size = $options['default_size'];
    } else {
        $size = absint($size);
        if ($size < 1) {
            $size = 1;
        } elseif ($size > 512) {
            $size = 512;
        }
    }
    // Retrieves user data by user ID.
    $user = get_userdata($user_id);
    // Returns if no user data was retrieved.
    if (empty($user)) {
        return false;
    }
    $email = $user->user_email;
    if (empty($default)) {
        // Retrieves values for the named option.
        $avatar_default = get_option('avatar_default');
        if (empty($avatar_default)) {
            $default = 'mystery';
        } else {
            $default = $avatar_default;
        }
    }
    $email_hash = md5(strtolower(trim($email)));
    if (is_ssl()) {
        $host = 'https://secure.gravatar.com';
    } else {
        $host = sprintf('http://%d.gravatar.com', hexdec($email_hash[0]) % 2);
    }
    if ($default == 'mystery') {
        $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
    } elseif ($default == 'gravatar_default') {
        $default = '';
    } elseif (strpos($default, 'http://') === 0) {
        // Retrieves a modified URL (with) query string.
        $default = add_query_arg('s', $size, $default);
    }
    if ($alt === false) {
        $alt = '';
    } else {
        // Escapes HTML attributes.
        $alt = esc_attr($alt);
    }
    // Retrieves values for the named option.
    $avatar_rating = get_option('avatar_rating');
    // Retrieves user meta field based on user ID.
    $attachment_id = get_user_meta($user_id, 'avatar_manager_custom_avatar', true);
    // Returns if no attachment ID was retrieved.
    if (empty($attachment_id)) {
        return false;
    }
    // Determine whether Multisite support is enabled.
    if (is_multisite()) {
        // Switches the current blog to a different blog.
        switch_to_blog(get_user_meta($user_id, 'avatar_manager_blog_id', true));
    }
    // Retrieves attachment meta field based on attachment ID.
    $custom_avatar_rating = get_post_meta($attachment_id, '_avatar_manager_custom_avatar_rating', true);
    $ratings['G'] = 1;
    $ratings['PG'] = 2;
    $ratings['R'] = 3;
    $ratings['X'] = 4;
    if ($ratings[$custom_avatar_rating] <= $ratings[$avatar_rating]) {
        // Retrieves attachment meta field based on attachment ID.
        $custom_avatar = get_post_meta($attachment_id, '_avatar_manager_custom_avatar', true);
        if (!isset($custom_avatar[$size])) {
            // Generates a resized copy of the avatar image.
            $custom_avatar[$size] = avatar_manager_resize_avatar($attachment_id, $size);
            // Updates attachment meta field based on attachment ID.
            update_post_meta($attachment_id, '_avatar_manager_custom_avatar', $custom_avatar);
        }
        // Generates a full URI of an avatar image based on attachment ID and
        // size.
        $src = avatar_manager_generate_avatar_url($attachment_id, $size);
        $custom_avatar = '<img alt="' . $alt . '" class="avatar avatar-' . $size . ' photo avatar-default" height="' . $size . '" src="' . $src . '" width="' . $size . '">';
    } else {
        $src = $host . '/avatar/';
        $src .= $email_hash;
        $src .= '?s=' . $size;
        $src .= '&amp;d=' . urlencode($default);
        $src .= '&amp;forcedefault=1';
        $custom_avatar = '<img alt="' . $alt . '" class="avatar avatar-' . $size . ' photo avatar-default" height="' . $size . '" src="' . $src . '" width="' . $size . '">';
    }
    // Determines whether Multisite support is enabled.
    if (is_multisite()) {
        // Restores the current blog.
        restore_current_blog();
    }
    // Calls the functions added to avatar_manager_get_custom_avatar filter
    // hook.
    return apply_filters('avatar_manager_get_custom_avatar', $custom_avatar, $user_id, $size, $default, $alt);
}