4

I'm using D7, with CiviCRM 4.4.6. I had created a contribution page, with membership form included.

By now after renewal membership, the expiration date extend according to the end date. Eg:

Start Date: 1 Nov 2014
End date: 5 Nov 2014
Status: Expired

If renewal payment made on 11 Nov, for one month, the expiry date is changed to 5 Dec 2014.

But I want the expiry date to be one month after payment date, which is 11 Dec 2014.

Is there any way I can configure it to get the above result?

If not in configuration, any way I can change it in codes?

  • You might want to post this question in Stackoverflow instead. Also, even better, it would be great if you could help launch a new StackExchange site dedicated to CiviCRM by becoming a committer at site51 for it. – Joe Murray Nov 12 '14 at 5:00
5

This works in the 4.5.2 sandbox (unknown if it works in 4.4.6)

  1. Set your membership type to rolling instead of fixed
  2. Disable the "Grace" membership status
  3. If you are having a membership period shorter than 3 months, also disable or shorten the "New" membership status

An alternative workaround, which however may be a bit too clunky, would be to create a new membership type monthly and update the contribution page, so that it forces people to sign up for a new membership rather than renewing their existing one. This would, however, lead to the potential for overlapping memberships if they sign up for the new membership before the end of their old one.

| improve this answer | |
  • I see... If editing it in the code, is it possible? – vences Nov 12 '14 at 1:18
  • I don't think a new type is required, just to remove Grace period fir this membership, in which case it will be treated as a new membership rather than a renewal. – Joe Murray Nov 12 '14 at 4:54
  • Thanks Joe for pointing that out. Having run a couple of tests in the sandbox, I had to revise my answer... – Markus Forsberg Nov 12 '14 at 11:35
  • If you folks haven't already done so, it would be great to see you supporting the proposal for a new CiviCRM StackExchange site: area51.stackexchange.com/proposals/77367/… – Graham Feb 27 '15 at 14:01
2

If you really need this and are ready to write some code. Here is what you could do :

/**
 * hook_civicrm_pre
 */
function myextension_civicrm_pre( $op, $objectName, $id, &$params ) {
  // changing end date for the monthly membership

  if ($objectName == 'Membership' && $op == 'create' && $params['membership_type_id'] == MY_MEMBERSHIP_TYPE_ID) {

    // FIXME: don't know if it's in params or if you need to get it using the api
    $contribution_date = ... 

    // compute the new date
    $membershipDates = _getNewDatesForMyMembership($params['membership_type_id'], $params['join_date'], $contribution_date);

    // update the params, so it gets saved in the database
    $params['end_date'] = $membershipDates['end_date'];

  }
}

See also CRM_Member_BAO_MembershipType::getDatesForMembershipType to have an idea of how CiviCRM compute dates for membership.

| improve this answer | |
2

In the example you describe, where the renewal payment is made after the end date, removing/disabling the Grace period will have the desired effect. Essentially it will create a new membership starting from the date the payment was made.

This may have knock-on implications for you because the user will be immediately treated as a non-member from the end date rather than from the end of the grace period. So, if you were using the Civimember Roles Sync module in your Drupal site, and were, for example using that to manage access to content, there will be a period where your user will lose access to member-only content.

If the renewal takes place before the end date, then the grace period is irrelevant and the membership is simply extended for the period of the membership (one month, if I read your question correctly), starting from the previous end date, not the date the renewal was made.

| improve this answer | |
1

I'm not sure, but Admin > CiviMember>Membership Types, Edit link beside relevant type, and changing Fixed to Rolling might impact this, as might disabling the Grace status under Admin>CiviMember>Membership Status rules.

More likely you will need to program this using hook_civicrm_pre().

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.