diff --git bp-groups/bp-groups-functions.php bp-groups/bp-groups-functions.php
index 42659e5..17edf94 100644
|
|
function groups_get_current_group() { |
495 | 495 | |
496 | 496 | /*** Group Avatars *************************************************************/ |
497 | 497 | |
| 498 | function bp_groups_enable_group_avatars() { |
| 499 | return (bool) buddypress()->groups->enable_avatars; |
| 500 | } |
| 501 | |
498 | 502 | function groups_avatar_upload_dir( $group_id = 0 ) { |
499 | 503 | global $bp; |
500 | 504 | |
diff --git bp-groups/bp-groups-loader.php bp-groups/bp-groups-loader.php
index d0616c2..2fa2733 100644
|
|
class BP_Groups_Component extends BP_Component { |
73 | 73 | public $valid_status; |
74 | 74 | |
75 | 75 | /** |
| 76 | * Are group avatars enabled? |
| 77 | * |
| 78 | * @since BuddyPress (1.8) |
| 79 | */ |
| 80 | public $enable_avatars = true; |
| 81 | |
| 82 | /** |
76 | 83 | * Start the groups component creation process |
77 | 84 | * |
78 | 85 | * @since BuddyPress (1.5) |
… |
… |
class BP_Groups_Component extends BP_Component { |
304 | 311 | ) |
305 | 312 | ) ); |
306 | 313 | |
| 314 | // Enable group avatars |
| 315 | $this->enable_avatars = apply_filters( 'bp_enable_group_avatars', true ); |
| 316 | |
307 | 317 | // If avatar uploads are not disabled, add avatar option |
308 | | if ( ! (int) buddypress()->site_options['bp-disable-avatar-uploads'] ) { |
| 318 | if ( ! (int) buddypress()->site_options['bp-disable-avatar-uploads'] && bp_groups_enable_group_avatars() ) { |
309 | 319 | $this->group_creation_steps['group-avatar'] = array( |
310 | 320 | 'name' => __( 'Avatar', 'buddypress' ), |
311 | 321 | 'position' => 20 |
… |
… |
class BP_Groups_Component extends BP_Component { |
587 | 597 | // group navigation menu using the $this->current_group global. |
588 | 598 | } else if ( bp_is_single_item() ) { |
589 | 599 | $bp->bp_options_title = $this->current_group->name; |
590 | | $bp->bp_options_avatar = bp_core_fetch_avatar( array( |
591 | | 'item_id' => $this->current_group->id, |
592 | | 'object' => 'group', |
593 | | 'type' => 'thumb', |
594 | | 'avatar_dir' => 'group-avatars', |
595 | | 'alt' => __( 'Group Avatar', 'buddypress' ) |
596 | | ) ); |
597 | | if ( empty( $bp->bp_options_avatar ) ) { |
598 | | $bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />'; |
| 600 | |
| 601 | if ( bp_groups_enable_group_avatars() ) { |
| 602 | $bp->bp_options_avatar = bp_core_fetch_avatar( array( |
| 603 | 'item_id' => $this->current_group->id, |
| 604 | 'object' => 'group', |
| 605 | 'type' => 'thumb', |
| 606 | 'avatar_dir' => 'group-avatars', |
| 607 | 'alt' => __( 'Group Avatar', 'buddypress' ) |
| 608 | ) ); |
| 609 | if ( empty( $bp->bp_options_avatar ) ) { |
| 610 | $bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />'; |
| 611 | } |
599 | 612 | } |
600 | 613 | } |
601 | 614 | } |
diff --git bp-groups/bp-groups-template.php bp-groups/bp-groups-template.php
index ee73b19..06bae3d 100644
|
|
function bp_group_admin_tabs( $group = false ) { |
1467 | 1467 | |
1468 | 1468 | <li<?php if ( 'group-settings' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/group-settings' ) ?>"><?php _e( 'Settings', 'buddypress' ); ?></a></li> |
1469 | 1469 | |
1470 | | <?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?> |
| 1470 | <?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) && bp_groups_enable_group_avatars() ) : ?> |
1471 | 1471 | |
1472 | 1472 | <li<?php if ( 'group-avatar' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( bp_get_group_permalink( $group ) . 'admin/group-avatar' ) ?>"><?php _e( 'Avatar', 'buddypress' ); ?></a></li> |
1473 | 1473 | |
diff --git bp-templates/bp-legacy/buddypress/groups/groups-loop.php bp-templates/bp-legacy/buddypress/groups/groups-loop.php
index 6ba2223..86c4d15 100644
|
|
|
38 | 38 | <?php while ( bp_groups() ) : bp_the_group(); ?> |
39 | 39 | |
40 | 40 | <li> |
41 | | <div class="item-avatar"> |
42 | | <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a> |
43 | | </div> |
| 41 | <?php if ( bp_groups_enable_group_avatars() ) : ?> |
| 42 | <div class="item-avatar"> |
| 43 | <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ); ?></a> |
| 44 | </div> |
| 45 | <?php endif ?> |
44 | 46 | |
45 | 47 | <div class="item"> |
46 | 48 | <div class="item-title"><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a></div> |
diff --git bp-templates/bp-legacy/buddypress/groups/single/group-header.php bp-templates/bp-legacy/buddypress/groups/single/group-header.php
index 9954be3..50760c1 100644
|
|
do_action( 'bp_before_group_header' ); |
29 | 29 | |
30 | 30 | </div><!-- #item-actions --> |
31 | 31 | |
32 | | <div id="item-header-avatar"> |
33 | | <a href="<?php bp_group_permalink(); ?>" title="<?php bp_group_name(); ?>"> |
| 32 | <?php if ( bp_groups_enable_group_avatars() ) : ?> |
| 33 | <div id="item-header-avatar"> |
| 34 | <a href="<?php bp_group_permalink(); ?>" title="<?php bp_group_name(); ?>"> |
34 | 35 | |
35 | | <?php bp_group_avatar(); ?> |
| 36 | <?php bp_group_avatar(); ?> |
36 | 37 | |
37 | | </a> |
38 | | </div><!-- #item-header-avatar --> |
| 38 | </a> |
| 39 | </div><!-- #item-header-avatar --> |
| 40 | <?php endif ?> |
39 | 41 | |
40 | 42 | <div id="item-header-content"> |
41 | 43 | <span class="highlight"><?php bp_group_type(); ?></span> |
… |
… |
do_action( 'bp_before_group_header' ); |
61 | 63 | <?php |
62 | 64 | do_action( 'bp_after_group_header' ); |
63 | 65 | do_action( 'template_notices' ); |
64 | | ?> |
65 | | No newline at end of file |
| 66 | ?> |