Skip to:
Content

BuddyPress.org

Changeset 8759


Ignore:
Timestamp:
08/05/2014 04:23:56 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Bring bp_get_blog_avatar() up to speed with bp_get_group_avatar():

  • Add inline doc
  • Use bp_parse_args()
  • Add brackets and bring code formatting up to date
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-template.php

    r8758 r8759  
    479479     *     @type int|bool $height Default: false.
    480480     *     @type bool $id Currently unused.
    481      *     @type bool $no_grav Default: false.
     481     *     @type bool $no_grav Default: true.
    482482     * }
    483483     * @return string User avatar string.
     
    486486        global $blogs_template;
    487487
    488         $defaults = array(
     488        // Parse the arguments
     489        $r = bp_parse_args( $args, array(
    489490            'type'    => 'full',
    490491            'width'   => false,
     
    493494            'id'      => false,
    494495            'alt'     => sprintf( __( 'Profile picture of site author %s', 'buddypress' ), bp_core_get_user_displayname( $blogs_template->blog->admin_user_id ) ),
    495             'no_grav' => true
    496         );
    497 
    498         $r = wp_parse_args( $args, $defaults );
    499         extract( $r, EXTR_SKIP );
     496            'no_grav' => true,
     497        ) );
     498
     499        // Fetch the avatar
     500        $avatar = bp_core_fetch_avatar( array(
     501            'item_id'    => $blogs_template->blog->admin_user_id,
     502            'title'      => $blogs_template->blog->admin_user_email,
     503            //'avatar_dir' => 'blog-avatars',
     504            //'object'     => 'blog',
     505            'type'       => $r['type'],
     506            'alt'        => $r['alt'],
     507            'css_id'     => $r['id'],
     508            'class'      => $r['class'],
     509            'width'      => $r['width'],
     510            'height'     => $r['height']
     511        ) );
    500512
    501513        /***
     
    507519         * Use the 'bp_get_blog_avatar' filter instead.
    508520         */
    509         $avatar = apply_filters( 'bp_get_blog_avatar_' . $blogs_template->blog->blog_id, bp_core_fetch_avatar( array( 'item_id' => $blogs_template->blog->admin_user_id, 'type' => $type, 'alt' => $alt, 'width' => $width, 'height' => $height, 'class' => $class, 'email' => $blogs_template->blog->admin_user_email ) ) );
    510 
    511         return apply_filters( 'bp_get_blog_avatar', $avatar, $blogs_template->blog->blog_id, array( 'item_id' => $blogs_template->blog->admin_user_id, 'type' => $type, 'alt' => $alt, 'width' => $width, 'height' => $height, 'class' => $class, 'email' => $blogs_template->blog->admin_user_email ) );
     521        $avatar = apply_filters( 'bp_get_blog_avatar_' . $blogs_template->blog->blog_id, $avatar );
     522
     523        return apply_filters( 'bp_get_blog_avatar', $avatar, $blogs_template->blog->blog_id, $r );
    512524    }
    513525
Note: See TracChangeset for help on using the changeset viewer.