Skip to:
Content

bbPress.org


Ignore:
Timestamp:
03/07/2013 10:58:31 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Introduce bbp_get_dynamic_role_name() to handle getting a translated role name from the dynamic roles array. Use this to return a more accurate display role in bbp_get_user_display_role(). Hat tip alex-ye. Fixes #2248.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/capabilities.php

    r4753 r4793  
    441441
    442442/**
     443 * Gets a translated role name from a role ID
     444 *
     445 * @since bbPress (r4792)
     446 *
     447 * @param string $role_id
     448 * @return string Translated role name
     449 */
     450function bbp_get_dynamic_role_name( $role_id = '' ) {
     451    $roles = bbp_get_dynamic_roles();
     452    $role  = isset( $roles[$role_id] ) ? $roles[$role_id]['name'] : '';
     453
     454    return apply_filters( 'bbp_get_dynamic_role_name', $role, $role_id, $roles );
     455}
     456
     457/**
    443458 * Removes the bbPress roles from the editable roles array
    444459 *
Note: See TracChangeset for help on using the changeset viewer.