function privatemsg_delete_folder_form_submit in Privatemsg 5.3
Same name and namespace in other branches
- 5 privatemsg.module \privatemsg_delete_folder_form_submit()
File
- ./
privatemsg.module, line 1387
Code
function privatemsg_delete_folder_form_submit($form_id, $form_values) {
global $user;
$fid = intval(arg(2));
if ($fid == 0 || $form_values['delete'] != 1) {
drupal_goto('privatemsg/folders');
}
if (!db_result(db_query("SELECT fid FROM {privatemsg_folder} WHERE fid = %d AND uid = %d", $fid, $user->uid))) {
watchdog('privatemsg', t('Attempted use of unauthorized folder'), WATCHDOG_WARNING);
return drupal_access_denied();
}
db_query("DELETE FROM {privatemsg_folder} WHERE fid = %d", $fid);
db_query("UPDATE {privatemsg} SET recipient_del = 1 WHERE folder = %d", $fid);
drupal_set_message(t('Folder deleted.'));
drupal_goto('privatemsg/folders');
}