CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Restricting renewal of membership (and subcription)
Pages: [1]

Author Topic: Restricting renewal of membership (and subcription)  (Read 411 times)

joumak

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.6.1
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Restricting renewal of membership (and subcription)
November 22, 2013, 02:19:51 am
Hi!

Our client (a scientific society) wants to restrict renewal of membership in following way:
  • Membership period is 1 or 5 calendar years
  • Contacts without current membership can acquire either 1 or 5 year membership by membership signup & renewal form any time
  • Current members can renew their membership for 1 or 5 years few months before membership expires (e.g. from October).
  • It's not allowed to make multiple contributions for renewing membership over 1 or 5 year
So the contribution form for membership renewal is shown to current members only when their membership is about to expire in few months (because membership price can change for next year). After renewal the form should be hidden/disabled for members. Is this possible straight in the CiviCRM, or should the logic be implemented in CMS by querying CiviCRM API (I have already developed WordPress plugin for this kind of features)?

They have similar restrictions for subscribing their journal with special member price with following rules:
  • Subscription period is one calendar year
  • Subscription allowed only for current members
  • Only one subscription  / member
  • Subscriptions are allowed for next year few months before new year (e.g. from October to December)
  • Subscriptions should be possible in membership signup & renewal form
  • There should be separate contribution form for current members
What is best way to keep track of journal subscriptions? Should the restriction logic be done in CMS? I have created price set for membership signup & renewal form, separate contribution for current members, smart group for current subscribers and own financial type "Journal Subscription" to keep track of subscriptions. Is this best way to arrange things in CiviCRM?

Thanks,
Jouni



sushant

  • I post frequently
  • ***
  • Posts: 126
  • Karma: 8
  • CiviCRM version: v3.2.x,v3.3.x v4.0.x, v4.x,trunk
  • CMS version: Drupal 6/7 ,joomla 1.5,1.6
  • MySQL version: 5.1.51
  • PHP version: 5.3.3
Re: Restricting renewal of membership (and subcription)
November 22, 2013, 07:19:11 am
Hello joumak,

Membership type can be created for 1 or 5 year and also status can be handled using Membership status rule.

Quote
Contacts without current membership can acquire either 1 or 5 year membership by membership signup & renewal form any time.
Current members can renew their membership for 1 or 5 years few months before membership expires (e.g. from October).
It's not allowed to make multiple contributions for renewing membership over 1 or 5 year.

for above and subscription related functionality requires some customization in CiviCRM or you can put the logic in CMS by querying CiviCRM API.

Hth
CiviCRM Priority Support
http://support.civigardens.com/
http://osseed.com

joumak

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.6.1
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Restricting renewal of membership (and subcription)
November 26, 2013, 12:38:03 am
Thanks for the suggestions. Because I use shortcodes in WordPress to output CiviCRM contribution forms, I added to THEME/functions.php file a filter for the_content hook, that checks the contribution page id and decides if it's shown or not (based on membership due date) like this:
Code: [Select]
add_filter('the_content', 'mysite_custom_content_logic', 9, 1);
function mysite_custom_content_logic($content) {
    static $membership_contribution_form_ids = array(2);
    // Don't show shortcode contribution forms for current members & subscribers
    // if there is over 3 months to membership / journal subscription due date
    if (current_user_can('myplugin_access_member_content') && preg_match('/(\[civicrm\s+([^\]]*)\])/', $content, $matches)) {
        parse_str(strtr($matches[2], array(' ' => '&', '"' => '', "'" => '')), $shortcode_query_params);
        if (count(array_intersect(array('component', 'id'), array_keys($shortcode_query_params))) == 2) {
            if (!isset($shortcode_query_params['mode']) || $shortcode_query_params['mode'] == 'live') {
                $myplugin = MyPlugin::get_instance();
                if (in_array($shortcode_query_params['id'], $membership_contribution_form_ids)) {
                    $latest = $myplugin->get_latest_membership();
                    if (!isset($latest['end_date']) || !$latest['end_date']) return $content;
                    try {
                        $end_date = new DateTime($latest['end_date']);
                        $now = new DateTime();
                        if ($now->diff($end_date)->format('%a') > 90) {
                            $content = str_replace($matches[1], '<b>You can\'t renew your membership until 3 months before it\'s due</b>', $content);
                        }
                    } catch (Exception $e) {
                        return $content;
                    }
                }

            }
        }

    }
    return $content;
}

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Restricting renewal of membership (and subcription)

This forum was archived on 2017-11-26.