2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
form_set_error('name',t('The specified form name contains one or more illegal characters. Spaces or any other special characters expect dash (-) and underscore (_) are not allowed.'));
}
if(in_array($edit['name'],user_fields())){
if(in_array($form_values['name'],user_fields())){
form_set_error('name',t('The specified form name is reserved for use by Drupal.'));
}
// Validate the category:
if(!$edit['category']){
if(!$form_values['category']){
form_set_error('category',t('You must enter a category.'));
}
if($edit['category']=='account'){
if($form_values['category']=='account'){
form_set_error('category',t('The specified category name is reserved for use by Drupal.'));
drupal_set_message(t('The field has been created.'));
watchdog('profile',t('Profile field %field added under category %category.',array('%field'=>theme('placeholder',$form_values['title']),'%category'=>theme('placeholder',$form_values['category']))),WATCHDOG_NOTICE,l(t('view'),'admin/settings/profile'));
}
else{
returnconfirm_form('profile_confirm_delete',$form,t('Are you sure you want to delete the field %field?',array('%field'=>theme('placeholder',$field->title))),'admin/settings/profile',t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a \'hidden profile field\' so that it may only be accessed by administrators.',array('%edit-field'=>url('admin/settings/profile/edit/'.$fid))),t('Delete'),t('Cancel'));
db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, options = '%s', page = '%s' WHERE fid = %d",$form_values['title'],$form_values['name'],$form_values['explanation'],$form_values['category'],$form_values['weight'],$form_values['required'],$form_values['register'],$form_values['visibility'],$form_values['options'],$form_values['page'],$form_values['fid']);
drupal_set_message(t('The field has been updated.'));
}
cache_clear_all();
return'admin/settings/profile';
}
/**
* Menu callback; deletes a field from all user profiles.
*/
functionprofile_field_delete($fid){
$field=db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d",$fid));
returnconfirm_form('profile_field_delete',$form,t('Are you sure you want to delete the field %field?',array('%field'=>theme('placeholder',$field->title))),'admin/settings/profile',t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a %hidden-field so that it may only be accessed by administrators.',array('%edit-field'=>url('admin/settings/profile/edit/'.$fid),'%hidden-field'=>theme('placeholder','hidden profile field')),t('Delete'),t('Cancel')));
db_query('DELETE FROM {profile_fields} WHERE fid = %d',$form_values['fid']);
db_query('DELETE FROM {profile_values} WHERE fid = %d',$form_values['fid']);
cache_clear_all();
drupal_set_message(t('The field %field has been deleted.',array('%field'=>theme('placeholder',$form_values['title']))));
watchdog('profile',t('Profile field %field deleted.',array('%field'=>theme('placeholder',$form_values['title']))),WATCHDOG_NOTICE,l(t('view'),'admin/settings/profile'));
form_set_error('name',t('The specified form name contains one or more illegal characters. Spaces or any other special characters expect dash (-) and underscore (_) are not allowed.'));
}
if(in_array($edit['name'],user_fields())){
if(in_array($form_values['name'],user_fields())){
form_set_error('name',t('The specified form name is reserved for use by Drupal.'));
}
// Validate the category:
if(!$edit['category']){
if(!$form_values['category']){
form_set_error('category',t('You must enter a category.'));
}
if($edit['category']=='account'){
if($form_values['category']=='account'){
form_set_error('category',t('The specified category name is reserved for use by Drupal.'));
drupal_set_message(t('The field has been created.'));
watchdog('profile',t('Profile field %field added under category %category.',array('%field'=>theme('placeholder',$form_values['title']),'%category'=>theme('placeholder',$form_values['category']))),WATCHDOG_NOTICE,l(t('view'),'admin/settings/profile'));
}
else{
returnconfirm_form('profile_confirm_delete',$form,t('Are you sure you want to delete the field %field?',array('%field'=>theme('placeholder',$field->title))),'admin/settings/profile',t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a \'hidden profile field\' so that it may only be accessed by administrators.',array('%edit-field'=>url('admin/settings/profile/edit/'.$fid))),t('Delete'),t('Cancel'));
db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, options = '%s', page = '%s' WHERE fid = %d",$form_values['title'],$form_values['name'],$form_values['explanation'],$form_values['category'],$form_values['weight'],$form_values['required'],$form_values['register'],$form_values['visibility'],$form_values['options'],$form_values['page'],$form_values['fid']);
drupal_set_message(t('The field has been updated.'));
}
cache_clear_all();
return'admin/settings/profile';
}
/**
* Menu callback; deletes a field from all user profiles.
*/
functionprofile_field_delete($fid){
$field=db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d",$fid));
returnconfirm_form('profile_field_delete',$form,t('Are you sure you want to delete the field %field?',array('%field'=>theme('placeholder',$field->title))),'admin/settings/profile',t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a %hidden-field so that it may only be accessed by administrators.',array('%edit-field'=>url('admin/settings/profile/edit/'.$fid),'%hidden-field'=>theme('placeholder','hidden profile field')),t('Delete'),t('Cancel')));
db_query('DELETE FROM {profile_fields} WHERE fid = %d',$form_values['fid']);
db_query('DELETE FROM {profile_values} WHERE fid = %d',$form_values['fid']);
cache_clear_all();
drupal_set_message(t('The field %field has been deleted.',array('%field'=>theme('placeholder',$form_values['title']))));
watchdog('profile',t('Profile field %field deleted.',array('%field'=>theme('placeholder',$form_values['title']))),WATCHDOG_NOTICE,l(t('view'),'admin/settings/profile'));