Changeset 8751
- Timestamp:
- 08/03/2014 02:17:58 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-template.php
r8750 r8751 550 550 } 551 551 552 /** 553 * Output the group avatar while in the groups loop. 554 * 555 * @since BuddyPress (1.0.0) 556 * 557 * @param array $args {@see bp_core_fetch_avatar()} 558 */ 552 559 function bp_group_avatar( $args = '' ) { 553 560 echo bp_get_group_avatar( $args ); 554 561 } 562 /** 563 * Return the group avatar while in the groups loop. 564 * 565 * @since BuddyPress (1.0.0) 566 * 567 * @param array $args {@see bp_core_fetch_avatar()} 568 */ 555 569 function bp_get_group_avatar( $args = '' ) { 556 global $bp, $groups_template; 557 570 global $groups_template; 571 572 // Bail if avatars are turned off 573 // @todo Should we maybe still filter this? 558 574 if ( ! buddypress()->avatar->show_avatars ) { 559 575 return false; 560 576 } 561 577 562 $defaults = array( 578 // Parse the arguments 579 $r = bp_parse_args( $args, array( 563 580 'type' => 'full', 564 581 'width' => false, … … 567 584 'id' => false, 568 585 'alt' => sprintf( __( 'Group logo of %s', 'buddypress' ), $groups_template->group->name ) 569 ); 570 571 $r = wp_parse_args( $args, $defaults ); 572 extract( $r, EXTR_SKIP ); 573 574 /* Fetch the avatar from the folder, if not provide backwards compat. */ 575 if ( !$avatar = bp_core_fetch_avatar( array( 'item_id' => $groups_template->group->id, 'object' => 'group', 'type' => $type, 'avatar_dir' => 'group-avatars', 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'title' => $groups_template->group->name, 'alt' => $alt ) ) ) 586 ) ); 587 588 // Fetch the avatar from the folder 589 $avatar = bp_core_fetch_avatar( array( 590 'item_id' => $groups_template->group->id, 591 'title' => $groups_template->group->name, 592 'avatar_dir' => 'group-avatars', 593 'object' => 'group', 594 'type' => $r['type'], 595 'alt' => $r['alt'], 596 'css_id' => $r['id'], 597 'class' => $r['class'], 598 'width' => $r['width'], 599 'height' => $r['height'] 600 ) ); 601 602 // If No avatar found, provide some backwards compatibility 603 if ( empty( $avatar ) ) { 576 604 $avatar = '<img src="' . esc_url( $groups_template->group->avatar_thumb ) . '" class="avatar" alt="' . esc_attr( $groups_template->group->name ) . '" />'; 577 578 return apply_filters( 'bp_get_group_avatar', $avatar ); 605 } 606 607 return apply_filters( 'bp_get_group_avatar', $avatar, $r ); 579 608 } 580 609
Note: See TracChangeset
for help on using the changeset viewer.