Using Rules to Prune Inactive Users - will this work? I am relatively new to Drupal and learning as I develop a new website for our network of chapters. Needless to say, that has been quite the challenge :)

One of the functionalities I needed was the ability to prune inactive users. We have this on our current system and like having it to keep our membership numbers accurate, as well as help our members feel more "secure" by knowing only active members have access to the chapter.

There were a couple of modules out there to do this, but they were all for Drupal 6 or only had development modules for Drupal 7. 

I found this link:
https://drupal.org/node/1582710

and have followed it to set up my own "prune users" using rules. But I have NO idea how to test this in the development stage and certainly don't want it to screw up and accidentally mess up memberships when we move to the live versions.

What I have done is as follows:

Set up the following components:


Send email stating user has been inactive for 30 days and schedule next letter in 30 days
Send email stating user has been inactive for 60 days and schedule next letter in 25 days
Send email stating user is in danger of being pruned and must login to keep account and schedule blocking user in 5 days.
Block user


Set up the following rules:


Inactive User: When user logs in, remove all currently scheduled rules and set component evaluation for inactive for 30 days letter.
Never Logged In: When user account is first approved, set component evaluation for inactive for 30 days letter.


I think this means that when a user first signs up, they will get scheduled for the inactive user letter. Every time they log in, it will reset to the 30 day letter in 30 days. If they never log in, in 30 days, they will get the first letter and the 2nd letter will schedule... until they are pruned. If they log in, everything resets.

I know this means that every user will have a scheduled inactive user letter task -- not sure if this will bog down my system too much?

Also, if this does sound right -- how do I go about testing it to make sure it works the way it is supposed to and doesn't accidentally block users its not supposed to?

One last thing -- what can I do to automatically delete the users that are "blocked" and have been members for a certain amount of time (to ensure that new members who are just not approved yet don't accidentally get "pruned"?)

If I have made a complete mess of this, please feel free to tell me so! Like I said, I am really new at this and still figuring it out as I go along... I appreciate any help you can give me!
Your solution "may" work, but another approach is to process the results of a VBO enabled view via Rules, whereas your rule performs 2 Rules Actions:


load the VBO list of users that are candidate for deletion.
add a loop to perform a Rules Action "delete user", for each user contained in your Views results.


For more details, have a look at the tutorial "How to process the results of a VBO enabled view via Rules?".

The advantage is that, if you first run it manually, you can see which users will get deleted (simply by browsing the Views results). When you feel comfortable enough, just automate this by rescheduling it every day (at the end of the rule itself, after you first triggered the rule manually).