| | 108 | |
| | 109 | /** |
| | 110 | * Add a bbPress Role column to the WordPress Users table |
| | 111 | * |
| | 112 | * @param array $columns Users table columns |
| | 113 | * @return array $columns |
| | 114 | */ |
| | 115 | function user_role_column( $columns ) { |
| | 116 | $columns['bbp_user_role'] = __( 'bbPress Role', 'bbpress' ); |
| | 117 | |
| | 118 | return $columns; |
| | 119 | } |
| | 120 | |
| | 121 | /** |
| | 122 | * Return user's bbPress role for display in the WordPress Users table |
| | 123 | * |
| | 124 | * @param string $retval |
| | 125 | * @param string $column_name |
| | 126 | * @param int $user_id |
| | 127 | * @return early if not the bbp_user_role column |
| | 128 | * @return string Displayable bbPress user role |
| | 129 | */ |
| | 130 | function user_role_row( $retval, $column_name, $user_id ) { |
| | 131 | if ( 'bbp_user_role' == $column_name ) { |
| | 132 | $user_role = bbp_get_user_role( $user_id ); |
| | 133 | if ( !$user_role ) |
| | 134 | return; |
| | 135 | |
| | 136 | $roles = bbp_get_editable_roles(); |
| | 137 | $retval = translate_user_role( $roles[$user_role]['name'] ); |
| | 138 | } |
| | 139 | |
| | 140 | return $retval; |
| | 141 | } |