diff --git src/bp-core/admin/bp-core-admin-settings.php src/bp-core/admin/bp-core-admin-settings.php
index 4c0a1e5..9573be1 100644
|
|
function bp_admin_setting_callback_group_creation() { |
182 | 182 | <?php |
183 | 183 | } |
184 | 184 | |
| 185 | /** |
| 186 | * 'Enable group avatars' field markup. |
| 187 | * |
| 188 | * @since BuddyPress (2.3.0) |
| 189 | */ |
| 190 | function bp_admin_setting_callback_group_avatar_uploads() { |
| 191 | ?> |
| 192 | <input id="bp-disable-group-avatar-uploads" name="bp-disable-group-avatar-uploads" type="checkbox" value="1" <?php checked( ! bp_disable_group_avatar_uploads() ); ?> /> |
| 193 | <label for="bp-disable-group-avatar-uploads"><?php _e( 'Allow customizable avatars for groups', 'buddypress' ); ?></label> |
| 194 | <?php |
| 195 | } |
| 196 | |
185 | 197 | /** Forums Section ************************************************************/ |
186 | 198 | |
187 | 199 | /** |
… |
… |
function bp_core_admin_settings_save() { |
280 | 292 | } |
281 | 293 | } |
282 | 294 | |
283 | | // Some legacy options are not registered with the Settings API |
| 295 | // Some legacy options are not registered with the Settings API, or are reversed in the UI. |
284 | 296 | $legacy_options = array( |
285 | 297 | 'bp-disable-account-deletion', |
286 | 298 | 'bp-disable-avatar-uploads', |
| 299 | 'bp-disable-group-avatar-uploads', |
287 | 300 | 'bp_disable_blogforum_comments', |
288 | 301 | 'bp-disable-profile-sync', |
289 | 302 | 'bp_restrict_group_creation', |
diff --git src/bp-core/bp-core-admin.php src/bp-core/bp-core-admin.php
index 643db6c..fb1a2cd 100644
|
|
class BP_Admin { |
337 | 337 | // Add the main section |
338 | 338 | add_settings_section( 'bp_xprofile', _x( 'Profile Settings', 'BuddyPress setting tab', 'buddypress' ), 'bp_admin_setting_callback_xprofile_section', 'buddypress' ); |
339 | 339 | |
340 | | $avatar_setting = 'bp_xprofile'; |
| 340 | add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', 'bp_xprofile' ); |
| 341 | register_setting( 'buddypress', 'bp-disable-avatar-uploads', 'intval' ); |
341 | 342 | |
342 | 343 | // Profile sync setting |
343 | 344 | add_settings_field( 'bp-disable-profile-sync', __( 'Profile Syncing', 'buddypress' ), 'bp_admin_setting_callback_profile_sync', 'buddypress', 'bp_xprofile' ); |
… |
… |
class BP_Admin { |
351 | 352 | // Add the main section |
352 | 353 | add_settings_section( 'bp_groups', __( 'Groups Settings', 'buddypress' ), 'bp_admin_setting_callback_groups_section', 'buddypress' ); |
353 | 354 | |
354 | | if ( empty( $avatar_setting ) ) { |
355 | | $avatar_setting = 'bp_groups'; |
356 | | } |
357 | | |
358 | 355 | // Allow subscriptions setting |
359 | 356 | add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation', 'buddypress', 'bp_groups' ); |
360 | 357 | register_setting ( 'buddypress', 'bp_restrict_group_creation', 'intval' ); |
| 358 | |
| 359 | // Allow group avatars. |
| 360 | add_settings_field( 'bp-disable-group-avatar-uploads', __( 'Group Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_avatar_uploads', 'buddypress', 'bp_groups' ); |
| 361 | register_setting( 'buddypress', 'bp-disable-group-avatar-uploads', 'intval' ); |
361 | 362 | } |
362 | 363 | |
363 | 364 | /** Forums ************************************************************/ |
… |
… |
class BP_Admin { |
393 | 394 | register_setting ( 'buddypress', '_bp_enable_akismet', 'intval' ); |
394 | 395 | } |
395 | 396 | } |
396 | | |
397 | | /** Avatar upload for users or groups ************************************/ |
398 | | |
399 | | if ( ! empty( $avatar_setting ) ) { |
400 | | // Allow avatar uploads |
401 | | add_settings_field( 'bp-disable-avatar-uploads', __( 'Profile Photo Uploads', 'buddypress' ), 'bp_admin_setting_callback_avatar_uploads', 'buddypress', $avatar_setting ); |
402 | | register_setting ( 'buddypress', 'bp-disable-avatar-uploads', 'intval' ); |
403 | | } |
404 | 397 | } |
405 | 398 | |
406 | 399 | /** |
diff --git src/bp-core/bp-core-options.php src/bp-core/bp-core-options.php
index 646ff07..1ca2ee6 100644
|
|
function bp_get_default_options() { |
55 | 55 | // Avatar uploads |
56 | 56 | 'bp-disable-avatar-uploads' => false, |
57 | 57 | |
| 58 | // Group Profile Photos |
| 59 | 'bp-disable-group-avatar-uploads' => false, |
| 60 | |
58 | 61 | // Allow users to delete their own accounts |
59 | 62 | 'bp-disable-account-deletion' => false, |
60 | 63 | |
… |
… |
function bp_disable_avatar_uploads( $default = true ) { |
581 | 584 | } |
582 | 585 | |
583 | 586 | /** |
| 587 | * Are group avatars disabled? |
| 588 | * |
| 589 | * For backward compatibility, this option falls back on the value of 'bp-disable-avatar-uploads' when no value is |
| 590 | * found in the database. |
| 591 | * |
| 592 | * @since BuddyPress (2.3.0) |
| 593 | * |
| 594 | * @param bool $default Optional. Fallback value if not found in the database. |
| 595 | * Defaults to the value of `bp_disable_avatar_uploads()`. |
| 596 | * @return bool True if group avatar uploads are disabled, otherwise false. |
| 597 | */ |
| 598 | function bp_disable_group_avatar_uploads( $default = null ) { |
| 599 | $disabled = bp_get_option( 'bp-disable-group-avatar-uploads', '' ); |
| 600 | |
| 601 | if ( '' === $disabled ) { |
| 602 | if ( is_null( $default ) ) { |
| 603 | $disabled = bp_disable_avatar_uploads(); |
| 604 | } else { |
| 605 | $disabled = $default; |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | * Filters whether or not members are able to upload group avatars. |
| 611 | * |
| 612 | * @since BuddyPress (2.3.0) |
| 613 | * |
| 614 | * @param bool $disabled Whether or not members are able to upload their groups avatars. |
| 615 | * @param bool $default Default value passed to the function. |
| 616 | */ |
| 617 | return (bool) apply_filters( 'bp_disable_group_avatar_uploads', $disabled, $default ); |
| 618 | } |
| 619 | |
| 620 | /** |
584 | 621 | * Are members able to delete their own accounts? |
585 | 622 | * |
586 | 623 | * @since BuddyPress (1.6.0) |
diff --git src/bp-groups/bp-groups-loader.php src/bp-groups/bp-groups-loader.php
index 58addca..79fefe2 100644
|
|
class BP_Groups_Component extends BP_Component { |
574 | 574 | 'position' => 10, |
575 | 575 | ), $default_params ); |
576 | 576 | |
577 | | if ( ! (int) bp_get_option( 'bp-disable-avatar-uploads' ) && buddypress()->avatar->show_avatars ) { |
| 577 | if ( ! bp_disable_group_avatar_uploads() ) { |
578 | 578 | $sub_nav[] = array_merge( array( |
579 | 579 | 'name' => __( 'Photo', 'buddypress' ), |
580 | 580 | 'slug' => 'group-avatar', |
diff --git src/bp-groups/bp-groups-screens.php src/bp-groups/bp-groups-screens.php
index a21fcb5..ae2ced3 100644
|
|
function groups_screen_group_admin_avatar() { |
906 | 906 | return false; |
907 | 907 | |
908 | 908 | // If the logged-in user doesn't have permission or if avatar uploads are disabled, then stop here |
909 | | if ( ! bp_is_item_admin() || (int) bp_get_option( 'bp-disable-avatar-uploads' ) || ! buddypress()->avatar->show_avatars ) |
| 909 | if ( ! bp_is_item_admin() || bp_disable_group_avatar_uploads() ) |
910 | 910 | return false; |
911 | 911 | |
912 | 912 | $bp = buddypress(); |
diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index dc419cb..5fe4452 100644
|
|
function bp_group_class() { |
709 | 709 | $classes[] = 'is-mod'; |
710 | 710 | } |
711 | 711 | |
| 712 | // Whether a group avatar will appear. |
| 713 | if ( bp_disable_group_avatar_uploads() ) { |
| 714 | $classes[] = 'group-no-avatar'; |
| 715 | } else { |
| 716 | $classes[] = 'group-has-avatar'; |
| 717 | } |
| 718 | |
712 | 719 | /** |
713 | 720 | * Filters classes that will be applied to row class of the current group in the loop. |
714 | 721 | * |
… |
… |
function bp_group_avatar( $args = '' ) { |
858 | 865 | function bp_get_group_avatar( $args = '' ) { |
859 | 866 | global $groups_template; |
860 | 867 | |
861 | | // Bail if avatars are turned off |
862 | | // @todo Should we maybe still filter this? |
863 | | if ( ! buddypress()->avatar->show_avatars ) { |
| 868 | // Bail if avatars are turned off. |
| 869 | if ( bp_disable_group_avatar_uploads() ) { |
864 | 870 | return false; |
865 | 871 | } |
866 | 872 | |
diff --git src/bp-templates/bp-legacy/css/buddypress.css src/bp-templates/bp-legacy/css/buddypress.css
index 9a64410..71aa588 100644
|
|
body.activity-permalink #buddypress ul.item-list li.activity-item { |
1281 | 1281 | margin: 10px 0 0 60px; |
1282 | 1282 | width: 50%; |
1283 | 1283 | } |
| 1284 | #buddypress ul.item-list li.group-no-avatar div.item-desc { |
| 1285 | margin-left: 0; |
| 1286 | } |
1284 | 1287 | #buddypress ul.item-list li div.action { |
1285 | 1288 | position: absolute; |
1286 | 1289 | top: 15px; |