How to properly filter bp_member_avatar
-
Still trying to wrap my head around taking advantage of these built in filters..
I need to change the alt-text here so that the member’s Full name is not shown. We’re using the “Usernames Only” plugin but it does not cover a few usages of our users’ names, such as in alt-text on /members avatars, as well as in pictures.php.
So first… avatars. The function in question:
function bp_member_avatar( $args = '' ) { echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ) ); } function bp_get_member_avatar( $args = '' ) { global $members_template; $fullname = !empty( $members_template->member->fullname ) ? $members_template->member->fullname : $members_template->member->display_name; $defaults = array( 'type' => 'thumb', 'width' => false, 'height' => false, 'class' => 'avatar', 'id' => false, 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), $fullname ) ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); return apply_filters( 'bp_get_member_avatar', bp_core_fetch_avatar( array( 'item_id' => $members_template->member->id, 'type' => $type, 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $members_template->member->user_email ) ) ); }
and what I tried:
/* Hide FUll Name from member avatar */add_filter('bp_member_avatar', 'mm_hide_name_in_alt_text'); function mm_hide_name_in_alt_text() { $defaults = array( 'type' => 'thumb', 'width' => false, 'height' => false, 'class' => 'avatar', 'id' => false, 'alt' => 'Profile Picture' ); return $defaults; }
Looking to understand why this isn’t working?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to properly filter bp_member_avatar’ is closed to new replies.