From 1a5f3010e30f2df1594cffb2bb8c2c9147d17816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Mon, 26 Nov 2007 08:30:19 +0000 Subject: #188498 by Rob Loach: user profile category names are stored and compared case insensitively, but the reserved category name check was not case insensitive --- modules/profile/profile.admin.inc | 2 +- modules/system/system.install | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc index 359789210..d19b6e01c 100644 --- a/modules/profile/profile.admin.inc +++ b/modules/profile/profile.admin.inc @@ -177,7 +177,7 @@ function profile_field_form_validate($form, &$form_state) { if (!$form_state['values']['category']) { form_set_error('category', t('You must enter a category.')); } - if ($form_state['values']['category'] == 'account') { + if (strtolower($form_state['values']['category']) == 'account') { form_set_error('category', t('The specified category name is reserved for use by Drupal.')); } $args1 = array($form_state['values']['title'], $form_state['values']['category']); diff --git a/modules/system/system.install b/modules/system/system.install index 43650b93d..d3e35e78d 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2702,6 +2702,20 @@ function system_update_6037() { return $ret; } +/** + * Ensure that "Account" is not used as a Profile category. + */ +function system_update_6038() { + $ret = array(); + if (db_table_exists('profile_fields')) { + $ret[] = update_sql('UPDATE {profile_fields} SET category = "Account settings" WHERE LOWER(category) = "account"'); + if ($affectedrows = db_affected_rows()) { + drupal_set_message(t('There were @affectedrows profile fields that used a reserved category name. They have been assigned to the category "Account settings".', array('@affectedrows' => $affectedrows))); + } + } + return $ret; +} + /** * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. -- cgit v1.2.3