1

I want to disable user accounts programmatically inside hook_cron() after a synchronisation job. I don't want to delete the users because of their generated content. But they should not be able to log in and receive any notification-mails and stuff like that.

Should I use the user status field for that? And if so should I use user_save to change this as I don't want drupal to send out mails to the users (via _user_mail_notify inside user_save) or just set the status fields inside the db? Are there any other hooks or functions that I would miss doing that?

1 Answer 1

1

Updating status through user_save() is a good way of doing it.

Also note that when you set status to a value different from 1, $op will get set to 'status_blocked', for which no email will be sent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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