1

Some module is using drupal_set_message() to show a message at the top of the administrative pages.

I would like to figure out from where it is coming from. Is there any way to determine what module is creating it? How do I remove it?

3
  • Install Devel and stick dpm(debug_backtrace()); in drupal_set_message() temporarily - that'll tell you where it comes from. Actually no, don't do that, you'll get a recursive loop...you can play around with a static var to short the recursion though
    – Clive
    Jul 13, 2015 at 15:30
  • Try doing a grep on your project source folder for drupal_set_message . Something like : grep -r --include "*.php" drupal_set_message . or grep -r drupal_set_message .
    – rtome
    Jul 13, 2015 at 15:30
  • @Clive : please apply some kind of undo/rollback of the title of this question, which originally was about a "green area" related to drupal_set_message() ... That's different from "using drupal_set_message()" ... and seems like editing the question to make it fit an answer ... which is not what one should do, right? Sep 11, 2015 at 14:19

3 Answers 3

0

Are there any messages in your error log? You should be able to see a module name there.

drupal_set_message has no parameter to add a module name to the message so there is no straight forward method of finding the module. You could copy the string from the message and search in the translation page (if you have the locale module enabled. Or throw the string at Google and see what you find. That usually helps!

0

Is the node the only thing that it's logging out? If that's the case then it may be hard to find out which module is outputting it. If not then I would suggest what rtome says in the comment, although slightly modified.

If you SSH into the root of your drupal install, and run "find . -exec grep 'yourtexthere' {} \; -print" then it will search every file for that line of text and print out which files have it.

If the node is the only thing being printed, however, then you may do better to disable the modules one by one (or several at a time) until the message goes away.

(btw watchdog and drupal_set_message are not the same thing. Watchdog is what is logged to through the command watchdog() and which you can find in admin/reports/dblog)

2
  • I'm not sure if it's rather answer or request for clarification :(
    – Mołot
    Jul 13, 2015 at 16:03
  • To clarify it's drupal_set_message I think, it shows up in green ... I suppose I can turn them off one at a time but I thought perhaps there was an easier solution
    – user379468
    Jul 13, 2015 at 16:53
0

If you are asking to edit out the code calling drupal_set_message() from that module, I would rather suggest not doing it.
Disabling some messages is easy as installing the Disable Messages module, and setting it up. The module is described as follows:

Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal site owners are keen to show all the messages sent out by drupal core and all modules to their users. This module gives site administrators a reasonably powerful way to filter out messages shown to the end users.

Features

  • Filter out messages that match a full text string exactly.
  • Filter out messages that match a regular expression.
  • Permissions to specifically hide all messages of a given type from any role.
  • Disable all filtering for specific users.
  • Disable all filtering for specific paths.
  • Apply filtering only for specific paths.
  • Debug system to get messages in the HTML without showing it to the end users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.