summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Grossenbacher2010-07-09 20:21:52 (GMT)
committer Sascha Grossenbacher2010-07-09 20:21:52 (GMT)
commitea9c123d173afe37055debe1b2e3923d9b24d177 (patch)
tree1d152bbc3c03c41215b15ab509379fa9c144a627
parentc0bd37ccac2c34e1fffb16cfbacaee236480a2af (diff)
#832720 by Berdir | BenK: Added message when action is executed and no threads are selected
-rw-r--r--privatemsg.module8
-rw-r--r--privatemsg_filter/privatemsg_filter.module2
2 files changed, 8 insertions, 2 deletions
diff --git a/privatemsg.module b/privatemsg.module
index 3563933..d3c3849 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 <a href="!undo">undone</a>.', array('!undo' => $undo)));
}
+ return TRUE;
}
/**
diff --git a/privatemsg_filter/privatemsg_filter.module b/privatemsg_filter/privatemsg_filter.module
index cce3099..aee1e40 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']);
}