I find the default node messaging ("...has been updated.) distracting and frankly unnecessary when changing from one page to the next.

I would suggest suppressing this message (via drupal_get_messages) and replace it with messages when "Save" and "Finish" are clicked.

I haven't examined the Multistep code (yet) to see where this should be best implemented, but I wanted to float this idea to see what people think.

CommentFileSizeAuthor
#11 multistep.messages.patch824 bytesfranz
#7 multistep.messages.patch810 bytesfranz

Comments

chey’s picture

I like this idea! If I get some time I can take a look.

johnhanley’s picture

I briefly examined the code in multistep.module and it seems like the messaging could be controlled in hook_nodeapi() using a combination of the $op argument and $node->op property. I didn't have time to experiment, but perhaps the value of $node->op could be compared to the value of the corresponding button string for operations 'insert' or 'update'.

johnhanley’s picture

The following snippet (when inserted into a hook_nodeapi function) will suppress the "...has been updated." message displayed after clicking the next or back buttons. The message will, however, correctly display after clicking the "Finish" button.

    case 'prepare':
      // clear node update message prior to next step
      if ($messages = drupal_get_messages()) {
        foreach ($messages['status'] as $message) {
          if ($message != t('@type %title has been updated.', array('@type' => node_get_types('name', $node), '%title' => $node->title))) {
            drupal_set_message($message, 'status');
          }
        }
      }
      break;

I chose to insert the code in a custom module, but alternately it could be inserted into multistep.module starting at line 191 (if the maintainer finds it useful.)

tobiberlin’s picture

As I have not the needed experience in PHP / Drupal programming - how exactly has the function to be named in a custom module? In 6.x-1.5 version of this module line 191 is a function for the multistep menu block and I think that the above function might not be placed there?!

johnhanley’s picture

Version: 6.x-1.x-dev » 6.x-1.4
Status: Needs review » Active

Yeah, I wouldn't recommend modifying (hacking) the module directly. That comment was intended for the maintainer.

Anyway, you'll need to read-up on how to create a custom module (it's pretty straightforward) and insert the following code:

<?php
custom_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'prepare':
      // clear node update message prior to next step
      if ($messages = drupal_get_messages()) {
        foreach ($messages['status'] as $message) {
          if ($message != t('@type %title has been updated.', array('@type' => node_get_types('name', $node), '%title' => $node->title))) {
            drupal_set_message($message, 'status');
          }
        }
      }
      break;
  }
}
?>
franz’s picture

subscribe, works as it is stated.

franz’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new810 bytes

Marking as needs review. Patch attached as suggested by Bacteria Man on #3.

franz’s picture

@tobiberlin, I think it was meant to be on line 292, actually.

dealancer’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Status: Active » Needs review

I have issues with that. Error messages does not displayed on user registration page if content profile field are shown there. Investigating the problem.

dealancer’s picture

Patch clears any messages except status, so I have rewrote it a bit. I have used

   $messages = drupal_get_messages('status', TRUE)

instead of

   $messages = drupal_get_messages()

So now it looks like this

      case 'prepare':
      // clear node update message prior to next step
      if ($messages = $messages = drupal_get_messages('status', TRUE)) {
        foreach ($messages['status'] as $message) {
          if ($message != t('@type %title has been updated.', array('@type' => node_get_types('name', $node), '%title' => $node->title))) {
            drupal_set_message($message, 'status');
          }
        }
      }
      break;
franz’s picture

StatusFileSize
new824 bytes

Updated patch with correction by dealancer.

chinita7’s picture

I tried the patch #11
I have 3 steps and it works on node editing page but works only partly on node creation page.

On node creation page when clicking the next button on the first step (to go to the second step) still show the message but the message is gone when clicking the next button on the second step (to go to the third step)

chinita7’s picture

I tried also #7 but it was the same.

chinita7’s picture

I just realized that the message showing when clicking the next button on the first step to go to the second step on node creation page is "...has been created" but not "...has been updated"

Yes.. of cores the node has been not just updated but just created..
I wish I could hide this "...has been created" message as well until user click the save button on the last step.

johnhanley’s picture

I don't have time to do so at the moment, but it should be super easy to add in another condition to suppress the "created" message as well.

chinita7’s picture

In the mean time I will hide it by disable message module.
Only the thing is that on the last step the message says "updated" instead of "created" as the node is created on the first step.
Anyway it's not a really big deal for me so my problem was basically solved. Thanks for the code.