summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-01 21:26:44 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-01 21:26:44 +0000
commitca8eee7545f75c199bde0121bd6a0792d67c5b91 (patch)
tree5e805f30c93c7a005e0cb422dd0ea95ca849d84f /modules/system
parentb882d991d01544fb458cb58614fdba4fab0997eb (diff)
downloadbrdo-ca8eee7545f75c199bde0121bd6a0792d67c5b91.tar.gz
brdo-ca8eee7545f75c199bde0121bd6a0792d67c5b91.tar.bz2
#192056 by effulgentsia, Dave Cohen, andypost, hswong3i, geodaniel, pwolanin, and dahacouk: Ensure user's raw login name is never output directly.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.api.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index bcb9ec572..36a06df8d 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1165,7 +1165,7 @@ function hook_mail($key, &$message, $params) {
$context = $params['context'];
$variables = array(
'%site_name' => variable_get('site_name', 'Drupal'),
- '%username' => $account->name,
+ '%username' => format_username($account),
);
if ($context['hook'] == 'taxonomy') {
$object = $params['object'];
@@ -2665,5 +2665,27 @@ function hook_url_outbound_alter(&$path, &$options, $original_path) {
}
/**
+ * Alter the username that is displayed for a user.
+ *
+ * Called by format_username() to allow modules to alter the username that's
+ * displayed. Can be used to ensure user privacy in situations where
+ * $account->name is too revealing.
+ *
+ * @param &$name
+ * The string that format_username() will return.
+ *
+ * @param $account
+ * The account object passed to format_username().
+ *
+ * @see format_username()
+ */
+function hook_username_alter(&$name, $account) {
+ // Display the user's uid instead of name.
+ if (isset($account->uid)) {
+ $name = t('User !uid', array('!uid' => $account->uid));
+ }
+}
+
+/**
* @} End of "addtogroup hooks".
*/