bp_avatar_is_front_edit()

Checks whether Avatar UI should be loaded.

Description

Return

(bool) True if Avatar UI should load, false otherwise.

Source

File: bp-core/bp-core-avatars.php

2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
function bp_avatar_is_front_edit() {
    $retval = false;
 
    // No need to carry on if the current WordPress version is not supported.
    if ( ! bp_attachments_is_wp_version_supported() ) {
        return $retval;
    }
 
    if ( bp_is_user_change_avatar() && 'crop-image' !== bp_get_avatar_admin_step() ) {
        $retval = ! bp_core_get_root_option( 'bp-disable-avatar-uploads' );
    }
 
    if ( bp_is_active( 'groups' ) ) {
        // Group creation.
        if ( bp_is_group_create() && bp_is_group_creation_step( 'group-avatar' ) && 'crop-image' !== bp_get_avatar_admin_step() ) {
            $retval = ! bp_disable_group_avatar_uploads();
 
        // Group Manage.
        } elseif ( bp_is_group_admin_page() && bp_is_group_admin_screen( 'group-avatar' ) && 'crop-image' !== bp_get_avatar_admin_step() ) {
            $retval = ! bp_disable_group_avatar_uploads();
        }
    }
 
    /**
     * Use this filter if you need to :
     * - Load the avatar UI for a component that is !groups or !user (return true regarding your conditions)
     * - Completely disable the avatar UI introduced in 2.3 (eg: __return_false())
     *
     * @since BuddyPress 2.3.0
     *
     * @param bool $retval Whether or not to load the Avatar UI.
     */
    return apply_filters( 'bp_avatar_is_front_edit', $retval );
}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.