This is my patch for added roles to name (title's attribute).

CommentFileSizeAuthor
#2 title_added-2355069-1.patch1.24 KBNerOcrO
title_added.patch1021 bytesNerOcrO
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost’s picture

Status: Needs review » Needs work
+++ b/masquerade.module
@@ -606,13 +606,10 @@ function masquerade_block_1() {
+          $quick_switch_links[] = l($account->name, $switch_link, array('query' => array('token' => drupal_get_token($switch_link)), 'attributes' => array('title' => t('roles:') . ' ' . implode(', ', $account->roles))));

this is not a right way to display role names.

use a kind of $role_options = array_map('check_plain', user_roles());

NerOcrO’s picture

FileSize
1.24 KB

And now?

NerOcrO’s picture

Status: Needs work » Needs review
andypost’s picture

Status: Needs review » Needs work
+++ b/masquerade.module
@@ -606,13 +606,21 @@ function masquerade_block_1() {
+          foreach ($account->roles as $key => $role) {
+            $roles[] = $role . ' (' . $key . ')';

roles could be added via UI so needs sanitization, check core for usage of the role names

NerOcrO’s picture

Yes, the t() function sanitize this variable : http://cgit.drupalcode.org/drupal/tree/includes/bootstrap.inc?h=7.x#n1466.
More specifically, format_string().

NerOcrO’s picture

Status: Needs work » Needs review