You are here

function user_expire_notify_user in User Expire 7

Same name and namespace in other branches
  1. 8 user_expire.module \user_expire_notify_user()

Displays a message to users with expiring accounts.

Parameters

object $account: (Optional) A user object on which to report.

2 calls to user_expire_notify_user()
user_expire_set_expiration in ./user_expire.module
Set a specific user's expiration time.
user_expire_user_login in ./user_expire.module
Implements hook_user_login().

File

./user_expire.module, line 316
Main module file for User expire module.

Code

function user_expire_notify_user($account = NULL) {
  global $user;
  if (is_null($account)) {
    $account = $user;
  }

  // Only display a message on accounts with a current expiration date.
  if (empty($account->expiration)) {
    return;
  }
  if ($user->uid == $account->uid) {

    // Notify current user that expiration time is in effect.
    drupal_set_message(t("Your account's expiration date is set to @date.", array(
      '@date' => format_date($account->expiration),
    )));
  }
  else {

    // Notify user that expiration time is in effect for this user.
    drupal_set_message(t("%name's expiration date is set to @date.", array(
      '%name' => $account->name,
      '@date' => format_date($account->expiration),
    )));
  }
}