function privatemsg_list_submit in Privatemsg 6.2
Same name and namespace in other branches
- 6 privatemsg.module \privatemsg_list_submit()
- 7.2 privatemsg.pages.inc \privatemsg_list_submit()
- 7 privatemsg.pages.inc \privatemsg_list_submit()
Process privatemsg_list form submissions.
Execute the chosen action on the selected messages. This function is based on node_admin_nodes_submit().
1 string reference to 'privatemsg_list_submit'
- _privatemsg_action_form in ./
privatemsg.pages.inc - Returns a form which handles and displays thread actions.
File
- ./
privatemsg.pages.inc, line 69 - User menu callbacks for Privatemsg.
Code
function privatemsg_list_submit($form, &$form_state) {
// Load all available operation definitions.
$operations = module_invoke_all('privatemsg_thread_operations', $form['#list_argument']);
drupal_alter('privatemsg_thread_operations', $operations, $form['#list_argument']);
// Default "default" operation, which won't do anything.
$operation = array(
'callback' => 0,
);
// Check if a valid operation has been submitted.
if (isset($form_state['values']['operation']) && isset($operations[$form_state['values']['operation']])) {
$operation = $operations[$form_state['values']['operation']];
}
// Load all keys where the value is the current op.
$keys = array_keys($form_state['values'], $form_state['values']['op']);
// The first one is op itself, we need to use the second.
if (isset($keys[1]) && isset($operations[$keys[1]])) {
$operation = $operations[$keys[1]];
}
// Only execute something if we have a valid callback and at least one checked thread.
if (!empty($operation['callback'])) {
privatemsg_operation_execute($operation, $form_state['values']['threads'], $form_state['values']['account']);
}
$form_state['rebuild'] = TRUE;
$form_state['input'] = array();
}