1

I want to show a drupal message on all the nodes of blog type:

I have the following rule:

{ "rules_show_message_on_blogs" : {
    "LABEL" : "Show message on blogs",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "workflow_rules" ],
    "ON" : [ "node_view" ],
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "blog" : "blog" } }
        }
      },
      { "data_is" : { "data" : [ "view-mode" ], "value" : "full" } }      
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "This is a feature",
          "type" : "warning",
          "repeat" : 0
        }
      }
    ]
  }
}

I also have a search form on all the pages of the site. The problem is that the message is also shown after submitting the search form.

Any help would be highly appreciated?

6
  • 1
    Presumably there are blog posts in the search results that are being displayed in the 'full' view mode? If so then this would be the expected behaviour. Try changing your search results to use the teaser view mode instead of full, that should help
    – Clive
    Jul 9, 2013 at 8:02
  • I tried changing the criteria. Even if I enter some query without any search results. Drupal message gets popped up
    – qasimzee
    Jul 9, 2013 at 9:22
  • There must be something about your search workflow that invokes a full node view for a blog page; that rule simply won't fire unless node_view() is called on a node of type 'blog', with 'full' as the view mode argument. Without knowing more about your setup and what customisations you've made it's going to be very hard to suggest a solution
    – Clive
    Jul 9, 2013 at 9:25
  • Can you please try this on a vanilla drupal installation. I am sure you will be able to reproduce it.
    – qasimzee
    Jul 9, 2013 at 9:35
  • Have you tried it on a vanilla installation yourself? With no contrib modules installed and no configuration set up? If so this is a bug and I'd advise taking it to the Rules issue queue
    – Clive
    Jul 9, 2013 at 9:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.