3

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:

  1. Send email stating user has been inactive for 30 days and schedule next letter in 30 days

  2. Send email stating user has been inactive for 60 days and schedule next letter in 25 days

  3. Send email stating user is in danger of being pruned and must login to keep account and schedule blocking user in 5 days.

  4. Block user

Set up the following rules:

  1. Inactive User: When user logs in, remove all currently scheduled rules and set component evaluation for inactive for 30 days letter.

  2. 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!

  • Apologies. Since this was posted such a long time ago, I have just been using the above solution without too much issue. I am currently working on another project, but will try this option when I go back to these sites for updating. Thanks again for your answer! – Heather Oct 14 '16 at 1:38
2

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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