Example #1
0
/**
 * Are group avatars disabled?
 *
 * For backward compatibility, this option falls back on the value of 'bp-disable-avatar-uploads' when no value is
 * found in the database.
 *
 * @since BuddyPress (2.3.0)
 *
 * @param bool $default Optional. Fallback value if not found in the database.
 *                      Defaults to the value of `bp_disable_avatar_uploads()`.
 * @return bool True if group avatar uploads are disabled, otherwise false.
 */
function bp_disable_group_avatar_uploads($default = null)
{
    $disabled = bp_get_option('bp-disable-group-avatar-uploads', '');
    if ('' === $disabled) {
        if (is_null($default)) {
            $disabled = bp_disable_avatar_uploads();
        } else {
            $disabled = $default;
        }
    }
    /**
     * Filters whether or not members are able to upload group avatars.
     *
     * @since BuddyPress (2.3.0)
     *
     * @param bool $disabled Whether or not members are able to upload their groups avatars.
     * @param bool $default  Default value passed to the function.
     */
    return (bool) apply_filters('bp_disable_group_avatar_uploads', $disabled, $default);
}
/**
 * Allow members to upload avatars field.
 *
 * @since 1.6.0
 *
 * @uses checked() To display the checked attribute.
 */
function bp_admin_setting_callback_avatar_uploads()
{
    ?>

	<input id="bp-disable-avatar-uploads" name="bp-disable-avatar-uploads" type="checkbox" value="1" <?php 
    checked(!bp_disable_avatar_uploads(false));
    ?>
 />
	<label for="bp-disable-avatar-uploads"><?php 
    _e('Allow registered members to upload avatars', 'buddypress');
    ?>
</label>

<?php 
}