Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 3 years ago

#6415 closed enhancement (no action required)

Missing title element on group_amins and group_mods avatar

Reported by: danbp Owned by: hnla
Milestone: Priority: low
Severity: minor Version:
Component: Templates Keywords: needs-testing needs-patch needs-refresh
Cc: danco38@…

Description

By default, a group header shows a group avatar, with a group name by 'alt' & 'title', a group admin avatar and if exist, a mod avatar. Both are only visual effects for FF, Chrome,... users, as these browsers don't show 'alt' text.

Adding title='%s' to these pictures would be a good improvement.

group-admins: bp-groups-template.php:1351, trunk[9828]:1536
group-mods: bp-groups-template.php:1394, trunk[9828]:1579

Attachments (2)

6415-01.patch (2.0 KB) - added by hnla 4 years ago.
Adds title attr to group mod/admin lists items
6415-02.patch (2.0 KB) - added by hnla 4 years ago.
change admins to match mods use of displayname rather than nicename

Download all attachments as: .zip

Change History (18)

#1 @imath
4 years ago

  • Keywords needs-patch added

You should suggest a patch :)

#2 @danbp
4 years ago

  • Keywords has-patch added; needs-patch removed

Ha, ha, the do it yourself answer. Here it is ! :)

For group admins (line 1536)

<a href="<?php echo bp_core_get_user_domain( $admin->user_id, $admin->user_nicename, $admin->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'email' => $admin->user_email, 'title' => sprintf( ( '%s' ), bp_core_get_username( $admin->user_id ) ) ) ) ?></a>

For group mods (line 1579):

<a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email, 'title' => sprintf( ( '%s' ), bp_core_get_username( $mod->user_id ) ) ) ) ?></a>

alt tag is automatically added by bp_core_fetch_avatar, so i simply replaced it by title in the original code and to get the short nicename, i use bp_core_get_username instead of bp_core_get_user_displayname.

#3 @DJPaul
4 years ago

  • Milestone changed from Awaiting Review to 2.4

#4 @DJPaul
4 years ago

  • Owner set to hnla
  • Status changed from new to assigned

@hnla can you review this once we're into 2.4 dev, please? Thanks.

#5 @hnla
4 years ago

Will do.

#6 @DJPaul
4 years ago

  • Keywords needs-testing added

#7 @hnla
4 years ago

I'll patch along the lines suggested ( title should be on the parent anchor though, and printf() as this isn't doing anything other than echoing out a string so sprintf seems wrong?)

One question why are we using username rather than displayname? Brevity? As this is browser chrome we don't worry or have to worry about long labels so shouldn't we display the users name as they intend on people seeing it around the site?

@hnla
4 years ago

Adds title attr to group mod/admin lists items

#8 @hnla
4 years ago

  • Priority changed from normal to low
  • Severity changed from normal to minor
  • Type changed from defect (bug) to enhancement

@hnla
4 years ago

change admins to match mods use of displayname rather than nicename

#9 @danbp
4 years ago

Thxs @hnla, your patch is OK.

That said, this is shorter and works also:

<a href="<?php echo bp_core_get_user_domain( $mod->user_id, $mod->user_nicename, $mod->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $mod->user_id, 'email' => $mod->user_email, 'title' => sprintf( ( '%s' ), bp_core_get_user_displayname( $mod->user_id ) ) ) ) ?></a>	



#10 @hnla
4 years ago

Unless the anchor takes an array of element attr it's the way I've done it as the title tag is on the parent Anchor.

More interested in why nicename over displayname?

#11 @danbp
4 years ago

@hnla, not sure i understand you correctly. Are you asking me if i'm interrested to know more about nicename over displayname or it's you who're more interrested about this ?

I suppose it's because $user_query use user_nicename. See:

class-bp-groups-group.php:223

$admin_mods = $wpdb->get_results( apply_filters( 'bp_group_admin_mods_user_join_filter', $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id ) ) );

class-bp-groups-member-suggestions.php:160
class-bp-groups-member.php:1022,1026

#12 @DJPaul
4 years ago

  • Milestone changed from 2.4 to 2.5

I don't think we want to do this. It's related to the discussion in #6525 so let's link these tickets and revisit in the future, unless someone wants to hustle and get both in, during this next week.

#13 @DJPaul
4 years ago

  • Keywords needs-patch needs-refresh added; has-patch removed
  • Milestone changed from 2.5 to Future Release

#14 @DJPaul
3 years ago

  • Component changed from Appearance - Template Parts to Templates

#15 @mercime
3 years ago

I agree with @DJPaul. See #7188, we should create new tooltip which is accessible and usable in all devices.

#16 @hnla
3 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.