summaryrefslogtreecommitdiff
path: root/modules/user/user.install
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-06-28 03:25:21 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-06-28 03:25:21 +0000
commitc6f79894a61cae202ddf2af48de037f44c2a7b26 (patch)
tree4d7f5583d4abd4bfd735a110a823fb5734b2b0a1 /modules/user/user.install
parent7f05c006bc3aace28cdfddb186757597f4029856 (diff)
downloadbrdo-c6f79894a61cae202ddf2af48de037f44c2a7b26.tar.gz
brdo-c6f79894a61cae202ddf2af48de037f44c2a7b26.tar.bz2
#660302 follow-up by heyrocker and jhodgdon: Fixed Migration path for changed user email tokens; don't complicate translation of default messages.
Diffstat (limited to 'modules/user/user.install')
-rw-r--r--modules/user/user.install44
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/user/user.install b/modules/user/user.install
index cd69c4c6c..ca7514137 100644
--- a/modules/user/user.install
+++ b/modules/user/user.install
@@ -670,6 +670,50 @@ function user_update_7010() {
->execute();
}
+
+/**
+ * Updates email templates to use new tokens.
+ *
+ * This function upgrades customized email templates from the old !token format
+ * to the new core tokens format. Additionally, in Drupal 7 we no longer e-mail
+ * plain text passwords to users, and there is no token for a plain text
+ * password in the new token system. Therefore, it also modifies any saved
+ * templates using the old '!password' token such that the token is removed, and
+ * displays a warning to users that they may need to go and modify the wording
+ * of their templates.
+ */
+function user_update_7010() {
+ $message = '';
+
+ $tokens = array(
+ '!site-name-token' => '[site:name]',
+ '!site-url-token' => '[site:url]',
+ '!user-name-token' => '[user:name]',
+ '!user-mail-token' => '[user:mail]',
+ '!site-login-url-token' => '[site:login-url]',
+ '!site-url-brief-token' => '[site:url-brief]',
+ '!user-edit-url-token' => '[user:edit-url]',
+ '!user-one-time-login-url-token' => '[user:one-time-login-url]',
+ '!user-cancel-url-token' => '[user:cancel-url]',
+ '!password' => '',
+ );
+
+ $result = db_select('variable', 'v')
+ ->fields('v', array('name', 'value'))
+ ->condition('value', db_like('user_mail_') . '%', 'LIKE')
+ ->execute();
+
+ foreach ($result as $row) {
+ if (empty($message) && (strpos($row->value, '!password') !== FALSE)) {
+ $message = t('The ability to send users their passwords in plain text has been removed in Drupal 7. Your existing email templates have been modified to remove it. You should <a href="@template-url">review these templates</a> to make sure they read properly.', array('@template-url' => url('admin/config/people/accounts')));
+ }
+
+ variable_set($row->name, str_replace(array_keys($tokens), $tokens, $row->value));
+ }
+
+ return $message;
+}
+
/**
* @} End of "defgroup user-updates-6.x-to-7.x"
* The next series of updates should start at 8000.