4 replies [Last post]
pamreed's picture
Offline
Joined: 03/22/2010
Juice: 33
Was this information Helpful?

I have try everything I can think of but I can not get the action "Display a message to user' to work. Is there some kind of setting somewhere. I even tried putting it on the my sales tax conditional action which I can see is being trigger on the screen, but still no message show to the user. Where is the message going to be displayed? I assume it would either show on the top of the page or a message box would pop open. Please help. What is going on, I need this to work.

Thank you,
Pam

pamreed's picture
Offline
Joined: 03/22/2010
Juice: 33
Please Help

Hi Can any please help me with this. Why would the action 'Display a message to the user' not display? I am I just not getting what is supposed to do. I have search for days on the forum and google have not found anything. I am willing to have debug it if someone would suggest where to start. Anyone else get to this to work.

Thank you,
Pam

Uberchic's picture
Offline
Administrator
Joined: 08/29/2008
Juice: 754
Re: Please Help

Did you see this thread? http://drupal.org/node/253711 It suggests this is a bug in the drupal trigger system, though looks like there is a patch. Thread started 2 years ago, but commented as recently as the beginning of this month.

kekko1's picture
Offline
Joined: 10/05/2010
Juice: 14
Action send a message

Hi ,
I looked here, but I can not see why not receive the message.
Is there another solution?
Try changing the function
"System_message_action function" as written in the patch.
how?
I tried to change the function but I did not get results.

/**
* A configurable Drupal action. Sends a message to the current user's screen.
*/
function system_message_action(&$object, $context = array()) {
  global $user;
  $variables = array(
    '%site_name' => variable_get('site_name', 'Drupal'),
    '%username' => $user->name ? $user->name : variable_get('anonymous', t('Anonymous')),
  );

  // This action can be called in any context, but if placeholders
  // are used a node object must be present to be the source
  // of substituted text.
  switch ($context['hook']) {
    case 'nodeapi':
      // Because this is not an action of type 'node' the node
      // will not be passed as $object, but it will still be available
      // in $context.
      $node = $context['node'];
      break;
    // The comment hook also provides the node, in context.
    case 'comment':
      $comment = $context['comment'];
      $node = node_load($comment->nid);
      break;
    case 'taxonomy':
      $vocabulary = taxonomy_vocabulary_load($object->vid);
      $variables = array_merge($variables, array(
        '%term_name' => check_plain($object->name),
        '%term_description' => filter_xss_admin($object->description),
        '%term_id' => $object->tid,
        '%vocabulary_name' => check_plain($vocabulary->name),
        '%vocabulary_description' => filter_xss_admin($vocabulary->description),
        '%vocabulary_id' => $vocabulary->vid,
        )
      );
      break;
    default:
      // We are being called directly.
      $node = $object;
  }

  if (isset($node) && is_object($node)) {
    $variables = array_merge($variables, array(
      '%uid' => $node->uid,
      '%node_url' => url('node/'. $node->nid, array('absolute' => TRUE)),
      '%node_type' => check_plain(node_get_types('name', $node)),
      '%title' => check_plain($node->title),
      '%teaser' => check_markup($node->teaser, $node->format, FALSE),
      '%body' => check_markup($node->body, $node->format, FALSE),
      )
    );
  }
  $context['message'] = strtr(filter_xss_admin($context['message']), $variables);
  drupal_set_message($context['message']);
}

grazieeee

miaoulafrite's picture
Offline
Joined: 08/26/2010
Juice: 29
+1

hey kekko1,

i have currently a problem that is pretty similar to yours
i have the impression that $user is not available here.

in my case, the rule works if it is being executed manually (update order status) - meaning the user is clearly identified

what do you think?
did you get any result out of your investigations?