When I add or update a node, the node ID is also shown above the custom message.
Is this normal?
Can I disable that?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stefank’s picture

That shouldn't be displayed. I've seen that few time in dev version before releasing beta3. Anyways, any chance you could provide me steps to reproduce it? Any settings or additional modules what you r using? That will be very helpful.
Thanks

Just a though - have you flush caches just to see if it makes any difference?

Firewolf’s picture

I deactivated the module. In order to reproduce I now reinstalled it.
Currently I do not get the custom message anymore; only a black frame with the nid.

I use a lot of other modules.
Core 7.26, Content Access 1.2-beta2, Chaos Tools 1.4, Date 2.7, Conditional fields 3.0-alpha1, Entity Reference 1.1, CKEditor 1.13, IMCE 1.8, CSS Injector 1.10, Disable breadcrumbs 1.3, Entity 1.3, Pathauto 1.2, Token 1.5, Honeypot 1.16, Views 3.7

Hope this helps...

stefank’s picture

Hi @Firewolf,

I've installed a fresh copy of drupal with all the modules listed above. I can't reproduce it. Any chance you could give me some details about the csm settings? When actually you getting the nid(create, update or delete?) Also what user role are you getting the message and r u getting any errors in logs?
Thanks

sherick’s picture

Hi @stefank,

I think node ID is shown when node_save() is used in the custom module. Hope that helps.
Thanks.

jim0203’s picture

Status: Active » Closed (cannot reproduce)

Closing this as we can't reproduce it; also I'm pretty sure that node_save() isn't called anywhere in the module. More than happy to re-open if the bug can be reproduced.

ushashree_m’s picture

Same issue for me.
In my Ajax call back I am updating my node with node_save(), but the status message is not set. so it is adding the status message : $messages->add($node->nid, 'csm');.
So node Id is printing when I refresh my page. Can you please provide a solution for this.

cassien’s picture

Status: Closed (cannot reproduce) » Needs review

Same issue too.
Node id is displayed and the message is the default one.

Hamulus’s picture

FileSize
1.12 KB

I had same issue, but created the patch.
Now all works good for me.

The issue was because the module uses hook_node_update to set message.

CSM module sets it's message with NID that should be replaced with message from module's settings.
When we update node manually CSM replaces internal messages.

So when we use node_save in any other module, no message is set. CSM creates it's NID message but cant replace it by custom message.

pawel_r’s picture

#8 works, thanks!

  • jim0203 committed 9593224 on 7.x-1.x authored by Hamulus
    Issue #2222017 by Hamulus, Firewolf, pawel_r: node ID shown above custom...
jim0203’s picture

Status: Needs review » Fixed

Patch committed to 7.x-1.x (with some tweaks to get it to work properly). Thanks!

vbard’s picture

Version: 7.x-1.0-beta3 » 7.x-1.0-beta7
Status: Fixed » Active

My sorry, but issue remains in 7.x-1.0-beta7. Installing latest dev does not solve it.

jim0203’s picture

Status: Active » Postponed (maintainer needs more info)

Hi @sumerian: could you give me a little bit more information to help me fix this bug, please? A screenshot of what you are describing would be really helpful, as would a list of any modules you are using that you think might be causing this issue to occur. If you could try switching off a few of these modules until the issue disappears that would be great; I can then try to recreate the issue on my development environment.

vbard’s picture

FileSize
22.98 KB
267.1 KB

Hi @jim0203 and thanx for rapid reply!
Here is my drush pm-list output. And a screenshot with nid (510) and default node creation message (a green one). Tomorrow I'll try to make some of modules on-off to make things clearer.

jim0203’s picture

Status: Postponed (maintainer needs more info) » Needs work

Thanks! I will get onto this as soon as I can. Any further troubleshooting you are able to do would be really helpful :)

jim0203’s picture

Okay, I think I've managed to work out which modules you currently have enabled. Pm-list output follows; can you check this to make sure I've got everything (won't be relevant if I manage to recreate the issue!)

I'm guessing that ctoolspopups and mymodule are custom modules?

jim0203’s picture

Status: Needs work » Postponed (maintainer needs more info)

With the modules listed above installed I can't recreate the bug when setting custom create/update/delete messages for the "Article" node type with beta7, so I've changed the status back to "postponed".

Perhaps this is being caused by a specific configuration you have running on your site, or at the theme level? More than happy to get this fixed if you can help drag the bug down.

jim0203’s picture

FileSize
11.25 KB
jim0203’s picture

Title: Display of node ID » Stop storing stuff in $messages; create a dedicated session variable (was "Display of node ID")
Version: 7.x-1.0-beta7 » 7.x-1.x-dev
Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs work

A bit of background information:

When a node is created, updated, or deleted a function called _csm_node_ops($node, $op) is run. This stores the $node in the variable table, under the variable name csm_node_temp_nid (where nid is the node id number). It also adds a creates a new message which contains the nid, but this message is intended never to be displayed -- it's just a way of storing the nid so it can be retrieved later, and ultimately used to retrieve the full $node from the variable table...

...which happens in csm_message_alter(&$messages), which is the implementation of the hook_message_alter() hook as provided by the messages_alter module:

$nid = $messages->messages['csm'][0];
$node = variable_get('csm_node_temp_' . $nid, NULL);

At this point, the fake message is still set. A few lines down, it should be deleted:

$nid_message = $messages->match("/" . $nid . "/", 'csm');
$messages->remove($nid_message);

These lines are there twice, once for when no message is being changed and another time when messages *are* being changed.

So, a quick and dirty fix here would be for you to ensure that before this function returns, all of the messages stored in $messages->messages['csm'][$i] are destroyed. messages_alter provides a way to do this, or you may be able to hack it by hand. Have you got the skills to enable you to do this?

I think, however, that a better fix would be to stop storing this stuff in the $messages object in the first place, and to instead use a dedicated session variable (which is essentially what I'm doing by storing all this stuff in $messages). So that's what I'll do.

vbard’s picture

Hey Jim! I've done some research. This bug appears to be concerned with Omega theme.
So to reproduce it you can install Drupal, Omega, CSM, and make Omega default theme. And that's it!

jim0203’s picture

Title: Stop storing stuff in $messages; create a dedicated session variable (was "Display of node ID") » CSM doesn't play nice with the Omega theme, so stop storing stuff in $messages; create a dedicated session variable (was "Display of node ID")
Assigned: Unassigned » jim0203
FileSize
34.92 KB

Great work, thank you! I installed Omega and the bug happened immediately.

Only local images are allowed.

I'm going to try my proposed solution (storing stuff in a custom $_SESSION variable rather than as a dummy message) before looking too deeply into this, as it needs to be done anyway and I'm pretty sure it will fix this bug. I've got an extra feature that I want to include in the next dev release, too, and that's almost ready so I'll push the whole lot to dev as soon as it's ready, and post here so you can test.

  • jim0203 committed 4bc16b0 on 7.x-1.x
    Extensive changes to code base to fix issues #2222017 (node id sometimes...
jim0203’s picture

Status: Needs work » Needs review
jim0203’s picture

This should now be fixed in the dev release and beta8. I was having some problems getting the module to work with Omega, but I think this is to do with my dev environment. Please test and post any further issues.

vbard’s picture

Hi Jim! Much thanx to you for your work!
I've done testing of latest dev. It does work with Bartik (string changes, everything is OK) but it does not with Omega. Nid went away but the message remains default (Article qwert has been created.)

jim0203’s picture

Status: Needs review » Fixed

Ha, so what looked like a deeper Omega bug seems to be independent of my dev environment.

My initial investigation suggested that for some reason csm_message_alter() (the instance of hook_message_alter() that CSM uses to change messages) was not always firing when Omega is set as the default theme. I have no idea why this might be the case, but I will create a new issue to cover this bug.

jim0203’s picture

@sumerian, can you confirm whether CSM *ever* changed messages when Omega was set as the default theme? For example, when CSM displayed the nid in a message, did it also change the status message to be what you'd set it to? Because as it stands I don't think that the hook that fires to change messages works when Omega is set as the default theme ...

vbard’s picture

> can you confirm whether CSM *ever* changed messages when Omega was set as the default theme?
nope, never.
I can confirm that with Omega as default theme csm_message_alter() never fires.

jim0203’s picture

@sumerian: great, thanks! So it seems that Omega caused two problems with CSM (or vice versa): the stray "nid" messages (now fixed), and the fact that csm_message_alter() never fires -- or, more precisely, that no hook_message_alter() that feeds back in to the messages_alter.module ever fires.

I'll get on with fixing the second issue now.

jim0203’s picture

@sumerian: I may have a solution for you that gets CSM working with Omega. Can you check out #2622252-5: hook_message_alter() doesn't always fire when the Omega theme is used and comment in that thread, please?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.