Kevin Carwile

Move inactive users to a new member group


In this tutorial, we'll be creating a system that will move "inactive" members to a different member group if they haven't participated in the community for a given period of time.

Ingredients:

  • 1 Custom Action
  • 1 Rule

Step 1:

Create a custom action in rules.

Call it "Deactivate inactive member". After creating this custom action, add an action argument to it that will accept a member. Argument Name: "Member", Description: "Member to deactivate", Argument Type: "Object", Value Type: "Any Member ( \IPS\Member )", Required: Yes

Step 2:

Create a new rule.

Use the "Deactivate inactive member" custom action as the rule trigger event. Call it "Deactivate members if they have been inactive". Once you have created the rule, you will need to add a condition to the rule which checks if the member actually meets the criteria for being "inactive".

One way to do this would be to add a condition which checks "Member attribute values". Call it "Member last activity within the time period". Select "Last Activity" as the attribute to check, then choose the "within the last" option, and set the time period to an appropriate value such as 3 months. The "Member To Check" should be set to the argument from the custom action "Member to deactivate". Since this condition will check if the member HAS been active within the time period, make sure to check the "NOT" option for the condition so it is only true when they have not been active. Save the condition.

You may wish to add other conditions as you see fit.

Add an action to this rule which will be taken when the rule conditions are met. Select the "Change the primary group of a member" action. Call it "Move member to new group". Select a new group to move the member to and for the "Member To Change Primary Group For", choose the "Member to deactivate" event argument.

Step 3:

Schedule the custom action on a recurring basis.

Go to "Custom Actions" in  your rules ACP. Click the dropdown menu for "Deactivate inactive member" and choose "Schedule Manually". Choose "Recurring" for the action frequency. Choose an appropriate time period between scheduled runs, such as 7 days. Since you will want this action to be applied to all members in the community, choose "Member" as the bulk process option. Save the form.

That's it! Enjoy this recipe.

 

 

deactivate-members-who-have-been-inactive.xml


  • Like 3
  Report Article


User Feedback


There are no comments to display.