Following up from #2585591: Lock account after X days of inactivity by role, it would be nice to send emails to users, once per day, if their account is going to expire within the next 7 days.

user_expire_find_users_to_expire_by_role was designed to find users for this situation by just reducing the $seconds_since_login size by 7 days to find users who are going to expire in the next 7 days.

Comments

greggles created an issue. See original summary.

greggles’s picture

Assigned: Unassigned » greggles

OK, I'm going to work on this.

greggles’s picture

Status: Active » Needs review
StatusFileSize
new4.57 KB
kscheirer’s picture

  1. +++ b/user_expire.module
    @@ -317,6 +326,44 @@ function user_expire_notify_user($account = NULL) {
    +    watchdog('user_expire', 'Skipping warning as it was run within the last 24 hours', array(), WATCHDOG_DEBUG);
    

    run within the last @hours hours, where @hours is user_expire_warning_frequency / 60 * 60. Should match comment.

  2. +++ b/user_expire.module
    @@ -385,3 +432,25 @@ function user_expire_get_role_rules() {
    +    $message['body'][] = t('Because you have not logged in recently, your account at @site_name is due to be blocked in the near future. If you still use this site, please log in @login_url to avoid having your account blocked.',
    

    "is due to be blocked" might be shorter as "will be blocked".

    Would also be nice to include an estimate for when the blocking would occur, although since this is via cron a specific time is impossible.

greggles’s picture

Would also be nice to include an estimate for when the blocking would occur, although since this is via cron a specific time is impossible.

I thought about that too, but it felt like calculating it would be a pain :)

This patch fixes the two main things you noted.

  • greggles committed 9abb5a2 on 7.x-1.x
    Issue #2587303 by greggles, kscheirer: Notify users if their account...

Status: Needs review » Needs work

The last submitted patch, 5: 2587303_warn_users_before_inactive_block_5.patch, failed testing.

greggles’s picture

Status: Needs work » Fixed

I think the patch apply failure is from me committing a little too fast.

The current dev branch passes tests, so this is good.

Status: Fixed » Closed (fixed)

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