I am looking to send an email to author after admin approve the node which submit by user, but I don't see there is something like "after node published" in the "React on event" am I missing something or there is no such things exist anymore ?

CommentFileSizeAuthor
#3 ff2.png12.56 KBfreelylw

Comments

freelylw created an issue. See original summary.

tr’s picture

"publishing" a node is just changing a value stored on the node. There is no difference between publishing a node and changing the node title as far as Rules is concerned.

The event is "After updating a content item". This event is triggered for any changes to a node.

You also need to use Data Comparison conditions to check if the data value you're interested in has been changed. If you're checking to see if the title has changed, you would compare node_unchanged.title to node.title to see if they're different. If you're checking to see if the node was published, you would check that node_unchanged.status is FALSE and node.status is TRUE. You look at both the unchanged node and the changed node because you want to only react when there has been a change in the published status.

freelylw’s picture

StatusFileSize
new12.56 KB

Thanks, I am adding the comparison data, but plese suggest what's data value I should add, I don't see there is an option like “TRUE" or "False" that I can selected.
ss

tr’s picture

Status: Active » Fixed

Here, even easier - I forgot we had a Condition for "Node is published".

The important part is still the same, when the node is changed, you have to check that the old version of the node was unpublished AND the new version of the node is published. Here is an export of a Rule that works. You can import this and it should work on your site.

langcode: en
status: true
dependencies: {  }
id: test_unchanged
label: 'test unchanged'
events:
  -
    event_name: 'rules_entity_update:node'
description: 'Displays a system message when a node is published.'
tags: {  }
config_version: '3'
expression:
  id: rules_rule
  uuid: ce4935ca-30e1-4666-b46a-d67e3b313db9
  weight: 0
  conditions:
    id: rules_and
    uuid: 94389852-f598-4024-ae01-e4f416109642
    weight: 0
    conditions:
      -
        id: rules_condition
        uuid: 11b86634-9f34-459a-9166-519be6a3f05a
        weight: 0
        condition_id: rules_node_is_published
        negate: false
        context_values: {  }
        context_mapping:
          node: node
        context_processors: {  }
        provides_mapping: {  }
      -
        id: rules_condition
        uuid: 85abb0ad-5f72-4b49-be0e-052aae43f23d
        weight: 0
        condition_id: rules_node_is_published
        negate: true
        context_values: {  }
        context_mapping:
          node: node_unchanged
        context_processors: {  }
        provides_mapping: {  }
  actions:
    id: rules_action_set
    uuid: 98bd46ee-68c0-4352-b92d-44842c89ac2b
    weight: 0
    actions:
      -
        id: rules_action
        uuid: b2165ef3-0b39-4624-a545-fb4b45a41262
        weight: 0
        action_id: rules_system_message
        context_values:
          message: 'Node {{ node.title.value }} has been published.'
          type: status
          repeat: false
        context_mapping: {  }
        context_processors:
          message:
            rules_tokens: {  }
          type:
            rules_tokens: {  }
          repeat:
            rules_tokens: {  }
        provides_mapping: {  }

Status: Fixed » Closed (fixed)

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