WordPress filter hook

bp_core_avatar_folder_dir

Fired by 5 WordPress plugins, running on 160K+ sites between them.

“Filters the avatar folder directory path.”

How to use bp_core_avatar_folder_dir

It's a filter: your callback receives the value and 3 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'bp_core_avatar_folder_dir', function( $value, $item_id, $object, $avatar_dir ) {
	// Change $value here.
	return $value;
}, 10, 4 );

Argument names come from Jet Event System for BuddyPress's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

5 plugins that fire bp_core_avatar_folder_dir

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. BuddyPress icon BuddyPress90,000+ installs apply_filters( 'bp_core_avatar_folder_dir', ( $avatar_loc->path . $avatar_loc->dir . $params['item_id'] ), $params['item_id'], $params['object'], $params['avatar_dir'] ) bp-core/bp-core-avatars.php:514
  2. Import and export users and customers icon Import and export users and customers70,000+ installs apply_filters( 'bp_core_avatar_folder_dir', $avatar_dir . '/' . $user_id, $user_id, 'user', 'avatars' ) addons/buddypress.php:568
  3. WP2Cloud icon WP2Cloud10+ installs apply_filters( 'bp_core_avatar_folder_dir', dirname( $original_file ), $item_id, $object, $avatar_dir ) wp2cloud.php:1771
  4. Jet Event System for BuddyPress icon Jet Event System for BuddyPress10+ installs apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ) main/jet-events-templatetags.php:374
  5. u-wordpress icon u-wordpressFewer than 10 installs apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir ) bp-core-avatars.php:138

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.