drupaldrupal-7subscriptionorganic-groups

Drupal 7 OG Group Unsubscribe after given time period


I am new to drupal 7 and was willing to implement something like time based unsubscription from a OG Group.

I have users added in OG Group. I want to implement time based unsubscription of the users already added in the group say 'Computers'.

User say 'Tony' is added to the group 'Computers' today, now I wish that a user 'Tony' should be unsubscribed from the group 'Computers' after a subscription of 3 months (a specific time period).

A Notification message should be sent to user 'Tony'.

All the process should be based on systems current date and the joining date of user 'Tony' to the group 'Computers'.

Please help me with any solution.


Solution

  • Try using the rules module: http://drupal.org/project/rules

    Once you've enabled the module, you can create a rule (Administration » Configuration » Workflow » Rules) that runs each time cron is run on your site. I'm assuming cron runs hourly or daily.

    On your new rule that runs with cron, you'll have to add several actions

    1. Get group members from certain group
    2. Loop on those members
    3. Unsubscribe each user

    Does that work for you?


    Addition:

    Another thing that may help you get your list of groups and/or group members for this is installing and using the Views Bulk Operations module: http://drupal.org/project/views_bulk_operations

    Rules integrates with that, so maybe you can do the following:

    1. Create a VBO view that lists all your members from a certain group you're interested in keeping clean. Use as a filter on your view the time they've been a member if you'd like...
    2. Go back to your rule that runs on cron and choosing the following under 'Actions': 'Load list of entity ids from a VBO View' (screenshot attached) enter image description here
    3. Then add a loop on those users (second action)
    4. Then add an action for that loop that unsubscribes the users (third action)