IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
182 | 182 | <?php |
183 | 183 | } |
184 | 184 | |
| 185 | /** |
| 186 | * Allow group to upload avatars field |
| 187 | * |
| 188 | * @since BuddyPress (1.6) |
| 189 | * |
| 190 | * @uses checked() To display the checked attribute |
| 191 | */ |
| 192 | function bp_admin_setting_callback_group_avatar_uploads() { |
| 193 | ?> |
| 194 | <input id="bp-disable-group-avatar-uploads" name="bp-disable-group-avatar-uploads" type="checkbox" value="1" <?php checked( !bp_disable_group_avatar_uploads( false ) ); ?> /> |
| 195 | <label for="bp-disable-group-avatar-uploads"><?php _e( 'Enable Group Profile Photos', 'buddypress' ); ?></label> |
| 196 | <?php |
| 197 | } |
| 198 | |
185 | 199 | /** Forums Section ************************************************************/ |
186 | 200 | |
187 | 201 | /** |
… |
… |
|
284 | 298 | $legacy_options = array( |
285 | 299 | 'bp-disable-account-deletion', |
286 | 300 | 'bp-disable-avatar-uploads', |
| 301 | 'bp-disable-group-avatar-uploads', |
287 | 302 | 'bp_disable_blogforum_comments', |
288 | 303 | 'bp-disable-profile-sync', |
289 | 304 | 'bp_restrict_group_creation', |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
860 | 860 | |
861 | 861 | // Bail if avatars are turned off |
862 | 862 | // @todo Should we maybe still filter this? |
863 | | if ( ! buddypress()->avatar->show_avatars ) { |
| 863 | // @todo ! buddypress()->avatar->show_avatars If this is a test user profile avatars why is it here for group avatar? |
| 864 | if ( bp_disable_group_avatar_uploads() ) { |
864 | 865 | return false; |
865 | 866 | } |
866 | 867 | |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
358 | 358 | // Allow subscriptions setting |
359 | 359 | add_settings_field( 'bp_restrict_group_creation', __( 'Group Creation', 'buddypress' ), 'bp_admin_setting_callback_group_creation', 'buddypress', 'bp_groups' ); |
360 | 360 | register_setting ( 'buddypress', 'bp_restrict_group_creation', 'intval' ); |
| 361 | |
| 362 | // Allow avatar uploads for group |
| 363 | add_settings_field( 'bp-disable-group-avatar-uploads', __( 'Group Avatar Uploads', 'buddypress' ), 'bp_admin_setting_callback_group_avatar_uploads', 'buddypress', 'bp_groups' ); |
| 364 | register_setting( 'buddypress', 'bp-disable-group-avatar-uploads', 'intval' ); |
361 | 365 | } |
362 | 366 | |
363 | 367 | /** Forums ************************************************************/ |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
77 | 77 | */ |
78 | 78 | protected function setup_actions() { |
79 | 79 | |
| 80 | add_filter( 'bp_activity_allowed_tags', array( $this, 'set_allowed_tags_secondary_avatar' ) ); |
80 | 81 | // Template Output |
81 | 82 | add_filter( 'bp_get_activity_action_pre_meta', array( $this, 'secondary_avatars' ), 10, 2 ); |
82 | 83 | |
… |
… |
|
434 | 435 | } |
435 | 436 | |
436 | 437 | /** |
| 438 | * @param array $activity_allowedtags |
| 439 | * @package BuddyPress Theme |
| 440 | * @return array |
| 441 | */ |
| 442 | public function set_allowed_tags_secondary_avatar($activity_allowedtags) |
| 443 | { |
| 444 | $activity_allowedtags['br'] = array(); |
| 445 | return $activity_allowedtags; |
| 446 | } |
| 447 | |
| 448 | /** |
437 | 449 | * Add secondary avatar image to this activity stream's record, if supported. |
438 | 450 | * |
439 | 451 | * @since BuddyPress (1.7) |
… |
… |
|
446 | 458 | function secondary_avatars( $action, $activity ) { |
447 | 459 | switch ( $activity->component ) { |
448 | 460 | case 'groups' : |
| 461 | $secondary_avatar = bp_get_activity_secondary_avatar(); |
| 462 | if ( !$secondary_avatar || ( $secondary_avatar && bp_disable_group_avatar_uploads() ) ) { |
| 463 | $secondary_avatar = '<br>'; |
| 464 | } |
| 465 | |
| 466 | $reverse_content = strrev( $action ); |
| 467 | $position = strpos( $reverse_content, 'a<' ); |
| 468 | $action = substr_replace( $action, $secondary_avatar, -$position - 2, 0 ); |
| 469 | |
| 470 | break; |
| 471 | |
449 | 472 | case 'friends' : |
450 | 473 | // Only insert avatar if one exists |
451 | 474 | if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) { |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
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 | |
… |
… |
|
551 | 554 | * @param bool $value Whether or not members are able to upload their own avatars. |
552 | 555 | */ |
553 | 556 | return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) bp_get_option( 'bp-disable-avatar-uploads', $default ) ); |
| 557 | } |
| 558 | |
| 559 | /** |
| 560 | * @since BuddyPress (1.6.0) |
| 561 | * |
| 562 | * @uses bp_get_option() To get the avatar uploads option for group. |
| 563 | * |
| 564 | * @param bool $default Optional. Fallback value if not found in the database. |
| 565 | * Default: true. |
| 566 | * @return bool True if group avatar uploads are disabled, otherwise false. |
| 567 | */ |
| 568 | function bp_disable_group_avatar_uploads( $default = false ) { |
| 569 | |
| 570 | /** |
| 571 | * Filters whether or not members are able to upload their groups avatars. |
| 572 | * |
| 573 | * @since BuddyPress (1.6.0) |
| 574 | * |
| 575 | * @param bool $value Whether or not members are able to upload their groups avatars. |
| 576 | */ |
| 577 | return (bool) apply_filters( 'bp_disable_group_avatar_uploads', (bool) bp_get_option( 'bp-disable-group-avatar-uploads', $default ) ); |
554 | 578 | } |
555 | 579 | |
556 | 580 | /** |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
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(); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
573 | 573 | 'position' => 10, |
574 | 574 | ), $default_params ); |
575 | 575 | |
576 | | if ( ! (int) bp_get_option( 'bp-disable-avatar-uploads' ) && buddypress()->avatar->show_avatars ) { |
| 576 | if ( !bp_disable_group_avatar_uploads() ) { |
577 | 577 | $sub_nav[] = array_merge( array( |
578 | 578 | 'name' => __( 'Photo', 'buddypress' ), |
579 | 579 | 'slug' => 'group-avatar', |