Answers.Body: <p>In your Courier Blueprint listen to <code>entry.beforeSaveEntry</code> events and use this code for the Trigger Condition:</p>
  
  <pre><code>{% set oldEntry = craft.entries({
      id: entry.id,
      status: null,
  }).first() %}
  
  {%- set wasDisabled = oldEntry.status == 'disabled' %}
  {%- set isEnabled = entry.status == 'live' %}
  
  {{- wasDisabled and isEnabled ? 'true' : 'false' }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T21:19:46.683Z
Answers.Text: Thanks Christian!
  
  I got it working as follows:
      
      {% set oldEntry = craft.entries.id(entry.id).status(null).first() %}
      {%- set wasDisabled = oldEntry.status == 'disabled' %}
      {%- set isLive = entry.status == 'live' %}
      {{- entry.sectionId == '3' and wasDisabled and isLive ? 'true' : 'false' }}
  
  I had to change `enabled` to `live`.
Answers.UserDisplayName: Andrea DeMers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-05T04:59:40.183Z
Answers.Text: Glad to hear, Andrea. I updated the answer accordingly.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-04T20:32:17.210Z
Answers.LastActivityDate: 2018-01-05T04:57:30.967Z
Answers.LastEditDate: 2018-01-05T04:57:30.967Z
Answers.UserDisplayName: carlcs
Body: <p>Moderation scenario:</p>
  
  <ol>
  <li>Registered user publishes an entry using a front-end form that sets the entry to <code>disabled</code>.</li>
  <li>Moderator receives email re new entry and changes status from <code>disabled</code> to <code>enabled</code> in the CP.</li>
  <li>User receives email informing them that the entry has been enabled.</li>
  </ol>
  
  <p>I’ve got steps 2 &amp; 3 working using both the Courier &amp; Postmaster plugins independently. However, when the user edits their entry via another front-end-form, they also receive an email notification.</p>
  
  <p>How can the user be notified <strong>only</strong> when the entry has been edited <strong>and</strong> the entry's status has been changed from <code>disabled</code> to <code>enabled</code>?</p>
  
  <p>Courier blueprints:</p>
  
  <p>Step 2: Triggers: <code>entries.onSaveEntry</code> and Conditions: <code>{{ entry.sectionId == '3' and isNewEntry ? 'true' : 'false' }}</code></p>
  
  <p>Step 3: Triggers: <code>entries.onSaveEntry</code> and Conditions: <code>{{ entry.sectionId == '3' ? 'true' : 'false' }}</code></p>
  
Tags: <emails><status><frontend-form>
Title: How can I use the Courier plugin to notify a user when an entry is enabled?
ThreadText: # How can I use the Courier plugin to notify a user when an entry is enabled?
  
  (Asked by: username_0 on 2018-01-04)
  
  Moderation scenario:
  
  1. Registered user publishes an entry using a front-end form that sets the entry to `disabled`.
  2. Moderator receives email re new entry and changes status from `disabled` to `enabled` in the CP.
  3. User receives email informing them that the entry has been enabled.
  
  I’ve got steps 2 & 3 working using both the Courier & Postmaster plugins independently. However, when the user edits their entry via another front-end-form, they also receive an email notification.
  
  How can the user be notified **only** when the entry has been edited **and** the entry's status has been changed from `disabled` to `enabled`?
  
  Courier blueprints:
  
  Step 2: Triggers: `entries.onSaveEntry` and Conditions: `{{ entry.sectionId == '3' and isNewEntry ? 'true' : 'false' }}`
  
  Step 3: Triggers: `entries.onSaveEntry` and Conditions: `{{ entry.sectionId == '3' ? 'true' : 'false' }}`
  
  **Tags:** emails, status, frontend-form
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-04. Score: 2 | Accepted answer
  
  In your Courier Blueprint listen to `entry.beforeSaveEntry` events and use this code for the Trigger Condition:
  
  ```
  {% set oldEntry = craft.entries({
      id: entry.id,
      status: null,
  }).first() %}
  
  {%- set wasDisabled = oldEntry.status == 'disabled' %}
  {%- set isEnabled = entry.status == 'live' %}
  
  {{- wasDisabled and isEnabled ? 'true' : 'false' }}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks Christian!  I got it working as follows:          {% set oldEntry = craft.entries.id(entry.id).status(null).first() %}     {%- set wasDisabled = oldEntry.status == 'disabled' %}     {%- set isLive = entry.status == 'live' %}     {{- entry.sectionId == '3' and wasDisabled and isLive ? 'true' : 'false' }}  I had to change `enabled` to `live`.  
  > **username_1**: Glad to hear, username_0. I updated the answer accordingly.  
  
  ---
  
  