Hi,
as the title explains, I have an expiry date in the user's profile (set/updated by the administrator or by import from csv) and I would like to block the users when this date is passed.

I can successfully block a user using the event "user logs in", but when the administrator changes the expiry date nothing happens. I suspect that this happens because the paremeter site_current-user refers to the user who performed the editing action (the administrator) and not the user who was updated, but I don't see other parameters which refer to the edited user.

I would also like to block users automatically via cronjob: rules should iterate through the users, check who's expired, and block him, but when I create a rule I don't see a list for the users.

Could somebody help me please?

Comments

TR’s picture

Component: Documentation » Scheduler
Status: Active » Fixed

"user logs in" is the wrong event to use for the case where the admin changes the expiration date. What you wan to act on is when the user is updated and the current date is > expiration date. That's a user is update event and a data comparison condition. The action will be to block the user. The 'account' parameter will refer to the user that has been updated.

rules should iterate through the users

That would be super inefficient, especially for a larger site. What you can try is to use a Views query to select those users which have an expiration date < current date AND are not currently blocked. That could still be a big query, but it's a lot better than the loop. The VBO action provides a list of these users and THEN you can loop over just the ones you need to block.

Another strategy would be to use Rules Scheduler and when the expiration date is set schedule a rule to automatically block the user. Then you will not have to run a big query or loop to search for users which need to be unblocked.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.