Answers.Body: <p>yes this can be problematic. You may also find that having other 'expired' memberships will trip you up when doing other searches etc. Therefore in a similar situation we have opted to find all the historic expired memberships and set them to a new Membership Status of 'previous expired'. that helped reduce confusion and would resolve your Scheduled Reminder issue to. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-23T20:03:38.127Z
Answers.LastActivityDate: 2015-10-23T20:03:38.127Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>I have a client who deals with a related situation.  In their case, we use SQL to update membership statuses. </p>
  
  <p>In their situation, they have people who create new memberships that supersede an old membership - but they still get membership reminders on the old membership.  This SQL runs hourly on a cron job and sets the old memberships to "expired" with the "status override" flag set:</p>
  
  <pre><code>mysql &lt;dbname&gt; -e "UPDATE civicrm_membership cm2  SET status_id=35, is_override=1  WHERE cm2.status_id = 34 AND  cm2.contact_id IN  (SELECT contact_id FROM (SELECT contact_id, status_id FROM civicrm_membership) cm JOIN civicrm_membership_status cms ON status_id = cms.id WHERE cms.is_current_member = 1 GROUP BY contact_id HAVING count(contact_id) &gt; 1)"
  </code></pre>
  
  <p>Owing to different membership status configuration, this won't work as-is for you, but should give you the right idea!
   They're in a slightly different situation in that they have "grace" membership statuses that are still active</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-26T15:52:20.903Z
Answers.Text: Hey, this is pretty awesome -- you're right that it doesn't work for us as-is, but this is definitely a great reference for us!
Answers.UserDisplayName: Alex Katayama
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-23T23:12:53.840Z
Answers.LastActivityDate: 2015-10-23T23:12:53.840Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>we recently encountered an issue after migrating to CiviCRM.</p>
  
  <p>In the original system, membership renewals were considered discrete, separate memberships rather than a contiguous one.</p>
  
  <p>When we imported the membership history from the original CRM to CiviCRM, the membership history imported fine, and the old memberships were marked as "Expired". However, due to a scheduled reminder rule ("Send membership renewal notice 7 days after expiry"), we're finding that people who have already renewed a membership and have an active one will still get a reminder notice because one of their expired memberships meets that criteria.</p>
  
  <p>Does anyone have a code snippet to adjust the schedule reminder for memberships to only send a reminder if there are zero ACTIVE memberships on record?</p>
  
Tags: <civimember><scheduled-reminders>
Title: Do not send scheduled reminder if at least 1 membership is active
ThreadText: # Do not send scheduled reminder if at least 1 membership is active
  
  (Asked by: username_0 on 2015-10-23)
  
  we recently encountered an issue after migrating to CiviCRM.
  
  In the original system, membership renewals were considered discrete, separate memberships rather than a contiguous one.
  
  When we imported the membership history from the original CRM to CiviCRM, the membership history imported fine, and the old memberships were marked as "Expired". However, due to a scheduled reminder rule ("Send membership renewal notice 7 days after expiry"), we're finding that people who have already renewed a membership and have an active one will still get a reminder notice because one of their expired memberships meets that criteria.
  
  Does anyone have a code snippet to adjust the schedule reminder for memberships to only send a reminder if there are zero ACTIVE memberships on record?
  
  **Tags:** civimember, scheduled-reminders
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-10-23. Score: 4 | Accepted answer
  
  yes this can be problematic. You may also find that having other 'expired' memberships will trip you up when doing other searches etc. Therefore in a similar situation we have opted to find all the historic expired memberships and set them to a new Membership Status of 'previous expired'. that helped reduce confusion and would resolve your Scheduled Reminder issue to.
  
  
  ---
  
  ### Answer by username_2 on 2015-10-23. Score: 2
  
  I have a client who deals with a related situation. In their case, we use SQL to update membership statuses.
  
  In their situation, they have people who create new memberships that supersede an old membership - but they still get membership reminders on the old membership. This SQL runs hourly on a cron job and sets the old memberships to "expired" with the "status override" flag set:
  
  ```
  mysql <dbname> -e "UPDATE civicrm_membership cm2  SET status_id=35, is_override=1  WHERE cm2.status_id = 34 AND  cm2.contact_id IN  (SELECT contact_id FROM (SELECT contact_id, status_id FROM civicrm_membership) cm JOIN civicrm_membership_status cms ON status_id = cms.id WHERE cms.is_current_member = 1 GROUP BY contact_id HAVING count(contact_id) > 1)"
  
  ```
  
  Owing to different membership status configuration, this won't work as-is for you, but should give you the right idea!
  They're in a slightly different situation in that they have "grace" membership statuses that are still active
  
  > **Comments:**
  > **username_0**: Hey, this is pretty awesome -- you're right that it doesn't work for us as-is, but this is definitely a great reference for us!  
  
  ---
  
  