Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/02/2015 01:01:03 AM (9 years ago)
Author:
boonebgorges
Message:

Allow group avatars to be disabled.

Props xgz, boonebgorges, imath, hnla.
Fixes #4677.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-options.php

    r9819 r9828  
    5555        // Avatar uploads
    5656        'bp-disable-avatar-uploads'       => false,
     57
     58        // Group Profile Photos
     59        'bp-disable-group-avatar-uploads' => false,
    5760
    5861        // Allow users to delete their own accounts
     
    582585
    583586/**
     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 */
     598function 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/**
    584621 * Are members able to delete their own accounts?
    585622 *
Note: See TracChangeset for help on using the changeset viewer.