bp_core_fetch_avatar

Filters an avatar URL wrapped in an element.

Description

apply_filters( 'bp_core_fetch_avatar', (string) $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr, (array) $params, (string) $params_item_id, (string) $params_avatar_dir, (string) $html_css_id, (string) $html_width, (string) $html_height, (string) $avatar_folder_url, (string) $avatar_folder_dir ); 

Parameters (9)

0. $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr — Optional. (string) => ''
The img src avatar url html class html css id html width html height html alt html title extra attr.
1. $params (array)
Array of parameters for the request.
2. $params_item_id (string)
ID of the item requested.
3. $params_avatar_dir (string)
Subdirectory where the requested avatar should be found.
4. $html_css_id (string)
ID attribute for avatar.
5. $html_width (string)
Width attribute for avatar.
6. $html_height (string)
Height attribute for avatar.
7. $avatar_folder_url (string)
The avatar folder url.
8. $avatar_folder_dir (string)
The avatar folder dir.

Usage

To run the hook, copy the example below.
  1. $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr = apply_filters( 'bp_core_fetch_avatar', $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr, $params, $params_item_id, $params_avatar_dir, $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ); 
  2.  
  3. if ( !empty( $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_core_fetch_avatar callback 
  2. function filter_bp_core_fetch_avatar( $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr, $params, $params_item_id, $params_avatar_dir, $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ) { 
  3. // make filter magic happen here... 
  4. return $img_src_avatar_url_html_class_html_css_id_html_width_html_height_html_alt_html_title_extra_attr
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_core_fetch_avatar', 'filter_bp_core_fetch_avatar', 10, 9 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_core_fetch_avatar', 'filter_bp_core_fetch_avatar', 10, 9 ); 

Defined (2)

The filter is defined in the following location(s).

/bp-core/bp-core-avatars.php  
  1. return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $avatar_url . '"' . $html_class . $html_css_id . $html_width . $html_height . $html_alt . $html_title . $extra_attr . ' />', $params, $params['item_id'], $params['avatar_dir'], $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ); 
  1. return apply_filters( 'bp_core_fetch_avatar', '<img src="' . $gravatar . '"' . $html_css_id . $html_class . $html_width . $html_height . $html_alt . $html_title . $extra_attr . ' />', $params, $params['item_id'], $params['avatar_dir'], $html_css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir );