| 1 |
<?php |
| 2 |
/** |
| 3 |
* Output a list of roles belonging to the current user. |
| 4 |
* |
| 5 |
* @var $roles array All applicable roles in name => label pairs. |
| 6 |
* |
| 7 |
* @package MultipleRoles |
| 8 |
*/ |
| 9 |
|
| 10 |
?><div class="md-multiple-roles"> |
| 11 |
<?php if ( ! empty( $roles ) ) : ?> |
| 12 |
<?php $it = new CachingIterator( new ArrayIterator( $roles ) ); ?> |
| 13 |
<?php foreach ( $it as $name => $label ) : ?> |
| 14 |
<a href="<?php echo esc_url( add_query_arg( 'role', $name, admin_url( 'users.php' ) ) ); ?>"><?php echo esc_html( translate_user_role( $label ) ); ?></a><?php echo $it->hasNext() ? ',' : ''; ?> |
| 15 |
<?php endforeach; ?> |
| 16 |
<?php else : ?> |
| 17 |
<span class="md-multiple-roles-no-role"><?php esc_html_e( 'None', 'multiple-roles' ); ?></span> |
| 18 |
<?php endif; ?> |
| 19 |
</div><!-- .md-multiple-roles --> |
| 20 |
|