Hello,

The submit messages set at admin/content/types/profile no longer seem to work.
I edit and save the node and the default update message shows, and not the one entered in the settings.

Anyone else experiencing this?

Comments

Shai’s picture

Yes, me too. Just installed it for the first time. The form on the content-type edit page is perfect, but has no effect.

YK85’s picture

Can anyone please assist?

ionmedia’s picture

csm-6.x-1.0-alpha4 not working too, after changing submit message and creating content i have standard message, but title on creation form works fine

ionmedia’s picture

 /**
 * Custom replacement for theme_status_messages(). Calls a function that
 * changes any node submit messages. Then carries on as per
 * theme_status_messages().
 */
function csm_theme_status_messages($display = NULL) {
  $dgm = drupal_get_messages($display);
  _csm_kill_status_messages($dgm);
  $output = '';
  foreach ($dgm as $type => $messages) {
    $output .= "<div class=\"messages $type\">\n";
    if (count($messages) > 1) {
      $output .= " <ul>\n";
      foreach ($messages as $message) {
        $output .= '  <li>'. $message ."</li>\n";
      }
      $output .= " </ul>\n";
    }
    else {
      $output .= $messages[0];
    }
    $output .= "</div>\n";
  }
  return $output;
}

can author explain what is going on ? i can't see drupal_set_message, only get

YK85’s picture

Has anyone had any luck? Thank you

g000fy’s picture

I downloaded the latest alpha and got it to work straightaway

junro’s picture

Still doesn't work for me :(

steeph’s picture

Well, same here. First it worked, after creating nodes of this type, the old created message message is showing again.

shv_rk’s picture

i have the same problem, just download CSM no changes at all!

jim0203’s picture

Status: Active » Postponed (maintainer needs more info)

I've just installed the current alpha4 release on a clean Drupal 6 install, and it's working as expected for me. If you're experiencing problems, please submit the steps you have gone through so I can reproduce the problem here and try and fix it.

webadpro’s picture

Hi,

I'm having the same issue. Just wondering if the Automatic Nodetitles can create any conflics because at the moment it is enabled.

Thanks,
Pat

Berliner-dupe’s picture

Same problem here with profile-content-type.

Has anybody a fix for this problem?

jim0203’s picture

jim0203’s picture

As per #10, to address this issue I need more information: please see http://drupal.org/node/73179

webadpro’s picture

As for the steps I have taken all the steps mentioned in the instructions. Nothin less nothing more. Although im wondering if this could be cause by another module that would be conflicting with this one?!

webadpro’s picture

I'm not sure why but it seems like its not always entering the function _csm_kill_status_messages.

webadpro’s picture

I think I have found the issue. And sorry for 3 posts in a row.

My problem is a conflict with the "Node comments" module.

Where csm_nodeapi executes the prepare action, it loads the comment node and not the created node so the function _csm_kill_status_messages never actually retreive the right node.

$node = variable_get('csm_node_temp', NULL);

I hope this helps and makes sense.

since I'm using the module: auto_nodetitle for auto title I've added:

elseif ($op == 'prepare' && !isset($node->nid)) {
    if(!module_exists('auto_nodetitle')){
			// Adding a new node. Store the node in the variable table so that it can be retrieved
			// by hook_form_alter and token substitutions can be done properly on the title of
			// the page.
			variable_set('csm_node_temp', $node);
		}
  }
YK85’s picture

Status: Postponed (maintainer needs more info) » Active

I also use auto_nodetitle module (http://drupal.org/project/auto_nodetitle).
I also have many many more modules installed =/ Is there some way of checking for conflict easily?

Berliner-dupe’s picture

Hi friends,

here is a minimodule. With this you can change the create/update/error-messages for the profile-node-type (write what you want) - other node-types are possible too.

Modulename: changemessage.module

function changemessage_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'profile_node_form': // <---- profile-node-type
    case 'story_node_form': // <---- other node-types possible (example)
    case 'car_foo_node_form': // <---- other node-types possible (example)
      $form['buttons']['submit']['#submit'][0] = 'changemessage_form_submit'; // <---- call the second function -> this override the standard message from node.pages.inc
      break;
  }
} 

function changemessage_form_submit($form, &$form_state) {  // <---- name from module
  global $user;

  $node = node_form_submit_build_node($form, $form_state);
  $insert = empty($node->nid);
  node_save($node);
  $node_link = l(t('view'), 'node/'. $node->nid);
  $watchdog_args = array('@type' => $node->type, '%title' => $node->title);
  $t_args = array('@type' => node_get_types('name', $node), '%title' => $node->title);

  if ($insert) {
    watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
    drupal_set_message(t('The profile/node/site has been created.', $t_args)); // <---- write what you want
  }
  else {
    watchdog('content', '@type: updated %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
    drupal_set_message(t('The profile/node/site has been updated', $t_args)); // <---- write what you want
  }
  if ($node->nid) {
    unset($form_state['rebuild']);
    $form_state['nid'] = $node->nid;
    $form_state['redirect'] = 'node/'. $node->nid;
  }
  else {
    drupal_set_message(t('Error - the profile/node/site could not be saved.'), 'error'); // <---- write what you want
  }
} 

This works very good by me - no problems with other modules. If you want use this minimodule together with http://drupal.org/project/better_messages - that give very nice popup-messages.

I hope this help you!

Regards Matthias

visualnotion’s picture

Confirmed that the fix in #17 by webadpro works for me.

Note: Add the code right after the closing bracket on line #191.

YK85’s picture

Status: Active » Reviewed & tested by the community

Can this be fixed in the module? Thank you!

xulispa’s picture

Only #19 work for me.

jim0203’s picture

Title: the submit messages no longer working » CSM conflicts with Node Comments module
Status: Reviewed & tested by the community » Active

Thanks to webadpro for narrowing now the possible causes of this issue. I'll get on with working on getting this fixed for the alpha 6 release.

If you've been experiencing similar problems then it may well be that CSM conflicts with other modules; if this seems to be the case for you then please open a new issue and list the modules you've got installed on your site.

jim0203’s picture

It seems to be the case that when Node Comments module is installed and a node that has node comments appended to it is deleted, then CSM will use the node comment's node type when changing messages.

I'm fixing this by adding a new csm_variable_set() function that will weed out errors such as this before calling variable_set(). Doing this in a new function will future-proof the module to some extent, as new code can be added to the function to fix similar bugs that come to light further down the line. I'll post here when this function is available in the dev snapshot.

jim0203’s picture

Status: Active » Closed (fixed)

This is now fixed in the dev snapshot and will be rolled into the next release.