diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-05-28 20:02:11 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-05-28 20:02:11 +0000 |
commit | 8c75cda0b1874fb026a05cd407179977441289d7 (patch) | |
tree | dbd874e306f241ae793342dc1e60f266c61e9a6c /modules | |
parent | 2082dcbcc9d285694e1e29d2f8abb4b0e9774bee (diff) | |
download | brdo-8c75cda0b1874fb026a05cd407179977441289d7.tar.gz brdo-8c75cda0b1874fb026a05cd407179977441289d7.tar.bz2 |
- Added some error checking to the profile module.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/profile.module | 6 | ||||
-rw-r--r-- | modules/profile/profile.module | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/modules/profile.module b/modules/profile.module index b97d9b093..7f5873d42 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -244,6 +244,12 @@ function profile_admin_add($type) { if ($error = profile_validate_form($data)) { drupal_set_message($error, 'error'); } + else if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE title = '%s'", $data['title']))) { + drupal_set_message(t('the specified title is already in use'), 'error'); + } + else if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'", $data['name']))) { + drupal_set_message(t('the specified name is already in use'), 'error'); + } else { db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, overview, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', '%s')", $data['title'], $data['name'], $data['explanation'], $data['category'], $type, $data['weight'], $data['required'], $data['overview'], $data['options'], $data['page']); diff --git a/modules/profile/profile.module b/modules/profile/profile.module index b97d9b093..7f5873d42 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -244,6 +244,12 @@ function profile_admin_add($type) { if ($error = profile_validate_form($data)) { drupal_set_message($error, 'error'); } + else if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE title = '%s'", $data['title']))) { + drupal_set_message(t('the specified title is already in use'), 'error'); + } + else if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'", $data['name']))) { + drupal_set_message(t('the specified name is already in use'), 'error'); + } else { db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, overview, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', '%s')", $data['title'], $data['name'], $data['explanation'], $data['category'], $type, $data['weight'], $data['required'], $data['overview'], $data['options'], $data['page']); |