diff --git a/privatemsg.module b/privatemsg.module index 3563933284ef410315aec5190a0c247863d46cf6..d3c3849e16590c72049045873302aa5048f9dffa 100644 --- a/privatemsg.module +++ b/privatemsg.module @@ -1935,7 +1935,8 @@ function privatemsg_operation_execute($operation, $threads, $account = null) { if (empty($threads)) { // Do not execute anything if there are no checked threads. - return; + drupal_set_message(t('You must first select one (or more) messages before you can take that action.'), 'warning'); + return FALSE; } // Add in callback arguments if present. if (isset($operation['callback arguments'])) { @@ -1953,6 +1954,10 @@ function privatemsg_operation_execute($operation, $threads, $account = null) { // Execute the chosen action and pass the defined arguments. call_user_func_array($operation['callback'], $args); + if (!empty($operation['success message'])) { + drupal_set_message($operation['success message']); + } + // Check if that operation has defined an undo callback. if (isset($operation['undo callback']) && $undo_function = $operation['undo callback']) { // Add in callback arguments if present. @@ -1974,6 +1979,7 @@ function privatemsg_operation_execute($operation, $threads, $account = null) { drupal_set_message(t('The previous action can be undone.', array('!undo' => $undo))); } + return TRUE; } /** diff --git a/privatemsg_filter/privatemsg_filter.module b/privatemsg_filter/privatemsg_filter.module index cce3099ac168b4079c1b916b503672fdefbf5c98..aee1e4024f9d4c455f969ff31296318a748faaec 100644 --- a/privatemsg_filter/privatemsg_filter.module +++ b/privatemsg_filter/privatemsg_filter.module @@ -551,10 +551,10 @@ function privatemsg_filter_archive_submit($form, &$form_state) { $operation = array( 'callback' => 'privatemsg_filter_remove_tags', 'callback arguments' => array('tag_id' => variable_get('privatemsg_filter_inbox_tag', '')), + 'success message' => t('The messages have been archived.'), 'undo callback' => 'privatemsg_filter_add_tags', 'undo callback arguments' => array('tag_id' => variable_get('privatemsg_filter_inbox_tag', '')), ); - drupal_set_message(t('The messages have been archived.')); privatemsg_operation_execute($operation, $form_state['values']['list']); }