Changeset 4207
- Timestamp:
- 09/06/2012 10:05:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bbp-includes/bbp-user-template.php
r4164 r4207 421 421 * 422 422 * @param int $user_id 423 * @uses bbp_get_user_role() To get the main user role 423 * @uses bbp_get_user_id() to verify the user ID 424 * @uses is_super_admin() to check if user is a super admin 425 * @uses bbp_is_user_inactive() to check if user is inactive 426 * @uses user_can() to check if user has special capabilities 424 427 * @uses apply_filters() Calls 'bbp_get_user_display_role' with the 425 428 * display role, user id, and user role … … 429 432 430 433 // Validate user id 431 $user_id = bbp_get_user_id( $user_id, false, false ); 432 $user_role = bbp_get_user_role( $user_id ); 434 $user_id = bbp_get_user_id( $user_id, false, false ); 433 435 434 436 // Capes earn Vinz Clortho status … … 436 438 $role = __( 'Key Master', 'bbpress' ); 437 439 440 // Inactive 441 } elseif ( bbp_is_user_inactive() ) { 442 $role = __( 'Inactive', 'bbpress' ); 443 438 444 // User is not registered 439 445 } elseif ( empty( $user_id ) ) { 440 446 $role = __( 'Guest', 'bbpress' ); 441 447 442 // Not the keymaster of Gozer 448 // Moderator 449 } elseif ( user_can( $user_id, 'moderate' ) ) { 450 $role = __( 'Moderator', 'bbpress' ); 451 452 // Bozo 453 } elseif ( user_can( $user_id, 'bozo' ) ) { 454 $role = __( 'Bozo', 'bbpress' ); 455 456 // Participant 457 } elseif ( user_can( $user_id, 'participate' ) ) { 458 $role = __( 'Participant', 'bbpress' ); 459 460 // Anyone else 443 461 } else { 444 445 // Get the user's main role for display 446 switch ( $user_role ) { 447 case 'administrator' : 448 case 'editor' : 449 case 'author' : 450 case 'contributor' : 451 case 'subscriber' : 452 default : // Any other role (plugins, etc...) 453 global $wp_roles; 454 455 // Load roles if not set 456 if ( !isset( $wp_roles ) ) 457 $wp_roles = new WP_Roles(); 458 459 // Get a translated role name 460 if ( !empty( $wp_roles->role_names[$user_role] ) ) 461 $role = translate_user_role( $wp_roles->role_names[$user_role] ); 462 463 // Fallback for registered user 464 else 465 $role = __( 'Member', 'bbpress' ); 466 467 break; 468 } 462 $role = __( 'Member', 'bbpress' ); 469 463 } 470 464 471 return apply_filters( 'bbp_get_user_display_role', $role, $user_id , $user_role);465 return apply_filters( 'bbp_get_user_display_role', $role, $user_id ); 472 466 } 473 467
Note: See TracChangeset
for help on using the changeset viewer.