Answers.Body: <p>Figured it out by manually editing the database and seeing how it was represented in the CiviCRM UI, so here's a guide in case anyone has the same need as me:</p>
  
  <p><strong>In order to automatically apply a discount if the contact has a membership that is active as of a specified date (example is February 18, 2017):</strong></p>
  
  <p>In the <strong>specify api string for advanced filter</strong> box, type <code>{"end_date":{"\u003E":"2017-02-17"}}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-12T17:12:44.740Z
Answers.LastActivityDate: 2016-10-12T17:12:44.740Z
Answers.UserDisplayName: matthewlehew
Body: <p>I've enabled CiviDiscount and currently have it set up to offer member rates to a conference. However, it applies the member rate if the individual is a member at the time of registration.</p>
  
  <p>Is there a way to apply the automatic discount after checking to see if the individual will be a member at the time of the event? That is, the end date of the membership must be after the event (or after a date of my choosing) in the CiviDiscount options. That way, if the individual's membership expires in between registration and the conference, they will need to renew their membership before registering for the conference.</p>
  
  <p><em>EDIT:</em> In terms of what I've tried, I have added "Membership" in the "Specify entity for advanced autodiscount" box and "{"end_date":{"$gt":"2017-02-05"}}" in the "Specify API string in the advanced filter" box. This causes the discount to fail to apply. When I blank those boxes, the discount applies correctly based on the test user's current membership (whose end date is in January 2017).</p>
  
  <p><em>EDIT 2:</em> I looked at the code on Github, and it looks like CiviDiscount is looking at the string using json_decode, so I changed the string to {"end_date":{">":"2017-02-17"}}. However, when looking at the form after saving it, the > is escaped to "&gt;". I feel like that may be the problem, any advice would be appreciated.</p>
  
Tags: <cividiscount>
Title: CiviDiscount that is dependent on status as of event date?
ThreadText: # CiviDiscount that is dependent on status as of event date?
  
  (Asked by: username_0 on 2016-10-06)
  
  I've enabled CiviDiscount and currently have it set up to offer member rates to a conference. However, it applies the member rate if the individual is a member at the time of registration.
  
  Is there a way to apply the automatic discount after checking to see if the individual will be a member at the time of the event? That is, the end date of the membership must be after the event (or after a date of my choosing) in the CiviDiscount options. That way, if the individual's membership expires in between registration and the conference, they will need to renew their membership before registering for the conference.
  
  *EDIT:* In terms of what I've tried, I have added "Membership" in the "Specify entity for advanced autodiscount" box and "{"end\_date":{"$gt":"2017-02-05"}}" in the "Specify API string in the advanced filter" box. This causes the discount to fail to apply. When I blank those boxes, the discount applies correctly based on the test user's current membership (whose end date is in January 2017).
  
  *EDIT 2:* I looked at the code on Github, and it looks like CiviDiscount is looking at the string using json\_decode, so I changed the string to {"end\_date":{">":"2017-02-17"}}. However, when looking at the form after saving it, the > is escaped to ">". I feel like that may be the problem, any advice would be appreciated.
  
  **Tags:** cividiscount
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-10-12. Score: 2
  
  Figured it out by manually editing the database and seeing how it was represented in the CiviCRM UI, so here's a guide in case anyone has the same need as me:
  
  **In order to automatically apply a discount if the contact has a membership that is active as of a specified date (example is February 18, 2017):**
  
  In the **specify api string for advanced filter** box, type `{"end_date":{"\u003E":"2017-02-17"}}`
  
  
  ---
  
  