Skip to:
Content

BuddyPress.org

Changeset 14151


Ignore:
Timestamp:
12/16/2025 05:13:46 PM (9 months ago)
Author:
espellcaste
Message:

Add pre-filter hook for avatar history.

Add bp_pre_avatar_get_avatars_history filter to allow short-circuiting avatar history retrieval.
Fix typo @parma to @param in bp_core_avatar_handle_upload docblock.

Props GaryJ.

See #9311 (14.0)

Location:
branches/14.0/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/14.0/src/bp-core/bp-core-attachments.php

    r13891 r14151  
    721721        // Enqueue me just once per page, please.
    722722        if ( did_action( 'bp_attachments_enqueue_scripts' ) ) {
    723                 return;
     723                return null;
    724724        }
    725725
  • branches/14.0/src/bp-core/bp-core-avatars.php

    r14051 r14151  
    967967         * Filters whether or not to handle uploading.
    968968         *
    969          * If you want to override this function, make sure you return false.
     969         * If you want to override this function, make sure you return `false`.
    970970         *
    971971         * @since 1.2.4
    972972         *
    973          * @param bool   $value             Whether or not to crop.
     973         * @param bool   $pre_filter        Whether or not to crop. Defaults to true.
    974974         * @param array  $file              Appropriate entry from $_FILES superglobal.
    975          * @parma string $upload_dir_filter A filter to be applied to 'upload_dir'.
     975         * @param string $upload_dir_filter A filter to be applied to 'upload_dir'.
    976976         */
    977977        if ( ! apply_filters( 'bp_core_pre_avatar_handle_upload', true, $file, $upload_dir_filter ) ) {
     
    22182218         *
    22192219         * @param bool $avatar_history True to disable avatar history. False otherwise.
    2220          *                    Default: `false`.
     2220         *                             Default: `false`.
    22212221         */
    22222222        return apply_filters( 'bp_disable_avatar_history', false );
     
    22702270 */
    22712271function bp_avatar_get_avatars_history( $item_id = 0, $object = 'user', $type = 'full' ) {
     2272        /**
     2273         * Filter to short-circuit the avatars history retrieval process.
     2274         *
     2275         * If you want to override this function, make sure you return something other than `null`.
     2276         *
     2277         * @since 14.5.0
     2278         *
     2279         * @param null|array $pre_filter Null to proceed with the default handling, or an array of avatars to override it.
     2280         * @param int        $item_id    The item ID we need the avatar version for.
     2281         * @param string     $object     The object the item ID relates to.
     2282         * @param string     $type       Get the `full`, `thumb` or `both` versions.
     2283         */
     2284        $pre_filter = apply_filters( 'bp_pre_avatar_get_avatars_history', null, $item_id, $object, $type );
     2285
     2286        if ( null !== $pre_filter ) {
     2287                return $pre_filter;
     2288        }
     2289
    22722290        if ( ! $item_id ) {
    22732291                return array();
Note: See TracChangeset for help on using the changeset viewer.