Answers.Body: <p>I was able to get this working with this reversal of logic in cividiscount.php:
  This seems to function properly on CiviDiscount 3.7 on our production server:</p>
  <pre><code>- if ($autodiscount) {
  -        break;
  + if (!$autodiscount) {
  +        continue;
  </code></pre>
  <p>We are still experiencing the puzzling issues mentioned below on our dev server with CiviDiscount 3.8.4.  Hopefully someone familiar with the code will be able to work through this and determine what the issue is.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-03T03:14:49.277Z
Answers.Text: I am now noticing some additional strange behavior on our dev server with CiviDiscount 3.8.4.  If I go to edit existing discounts from the last few years, the previously selected price sets in the Discounts for Events field are no longer displayed and price sets for events in the last few years no longer appear in the pick list and there are some blank lines instead.  I rebooted the server just in case something was hung, and there is no change.
Answers.UserDisplayName: Larry K.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-24T14:35:49.797Z
Answers.Text: This appears to have worked for me, with autodiscounts still otherwise not always working in CiviDiscount 3.8.8.. I also noted that the issue referred to in an earlier comment - https://lab.civicrm.org/dev/core/-/issues/2727 has been autoclosed by a housekeeping bot with no action taken to resolve the issue.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-20T16:48:57.607Z
Answers.Text: From the comment from Eileen in the linked issue it seems that a fix may be on the way. In the interim my autodiscounts work with the tweak from @larry-k
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-02T20:50:04.080Z
Answers.LastActivityDate: 2021-08-03T16:08:08.333Z
Answers.LastEditDate: 2021-08-03T16:08:08.333Z
Answers.UserDisplayName: Larry K.
Body: <p>Following updates to PHP 7.3.29 and MySQL 5.7.34 earlier this month, we discovered that discounts are no longer being automatically applied to event registration forms, public or back-end. The discount codes do work when applied manually. No errors are being logged. We just updated CiviDiscount to 3.8.2 from an older version, but that did not resolve the problem. We are on CiviCRM 5.33.5 on Drupal 7.81.  Any ideas what might be causing this? Thanks very much.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-27T03:38:15.973Z
Comments.Text: might be worth seeing if you can replicate on dmaster.demo.civicrm.org
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-27T14:52:35.197Z
Comments.Text: I did a test on demo and it worked fine.  It is also on PHP 7.3.29.  I wonder if some other extension we are using might be a factor.
Comments.UserDisplayName: Larry K.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-29T16:32:44.243Z
Comments.Text: This appears of be a version compatibility issue, as price sets that were created before 2018 still display properly.  If I copy or try to update an old price set, they stop displaying the discounts.
Comments.UserDisplayName: Larry K.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-07-29T21:42:48.263Z
Comments.Text: I have submitted this as a possible issue with price sets:  https://lab.civicrm.org/dev/core/-/issues/2727
Comments.UserDisplayName: Larry K.
Tags: <price-sets><cividiscount>
Title: CiviDiscount automatic discounts not being applied after server updates
ThreadText: # CiviDiscount automatic discounts not being applied after server updates
  
  (Asked by: username_0 on 2021-07-26)
  
  Following updates to PHP 7.3.29 and MySQL 5.7.34 earlier this month, we discovered that discounts are no longer being automatically applied to event registration forms, public or back-end. The discount codes do work when applied manually. No errors are being logged. We just updated CiviDiscount to 3.8.2 from an older version, but that did not resolve the problem. We are on CiviCRM 5.33.5 on Drupal 7.81. Any ideas what might be causing this? Thanks very much.
  
  **Tags:** price-sets, cividiscount
  
  > **Comments:**
  > **username_1**: might be worth seeing if you can replicate on dmaster.demo.civicrm.org  
  > **username_0**: I did a test on demo and it worked fine.  It is also on PHP 7.3.29.  I wonder if some other extension we are using might be a factor.  
  > **username_0**: This appears of be a version compatibility issue, as price sets that were created before 2018 still display properly.  If I copy or try to update an old price set, they stop displaying the discounts.  
  > **username_0**: I have submitted this as a possible issue with price sets:  https://lab.civicrm.org/dev/core/-/issues/2727  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-08-02. Score: 2
  
  I was able to get this working with this reversal of logic in cividiscount.php:
  This seems to function properly on CiviDiscount 3.7 on our production server:
  
  ```
  - if ($autodiscount) {
  -        break;
  + if (!$autodiscount) {
  +        continue;
  
  ```
  
  We are still experiencing the puzzling issues mentioned below on our dev server with CiviDiscount 3.8.4. Hopefully someone familiar with the code will be able to work through this and determine what the issue is.
  
  > **Comments:**
  > **username_0**: I am now noticing some additional strange behavior on our dev server with CiviDiscount 3.8.4.  If I go to edit existing discounts from the last few years, the previously selected price sets in the Discounts for Events field are no longer displayed and price sets for events in the last few years no longer appear in the pick list and there are some blank lines instead.  I rebooted the server just in case something was hung, and there is no change.  
  > **username_2**: This appears to have worked for me, with autodiscounts still otherwise not always working in CiviDiscount 3.8.8.. I also noted that the issue referred to in an earlier comment - https://lab.civicrm.org/dev/core/-/issues/2727 has been autoclosed by a housekeeping bot with no action taken to resolve the issue.  
  > **username_2**: From the comment from Eileen in the linked issue it seems that a fix may be on the way. In the interim my autodiscounts work with the tweak from @username_0-k  
  
  ---
  
  