Search »

Hooks Manager

Step 1: Add new client field

Add "Account Expiry Date" field

Extended Client Fields module configuration

  1. Install: Alright! The first step is to download and install the Extended Client Fields module. This module allows you to create additional fields to store whatever information you want for your client accounts.
  2. Add a new "expiry date" field. Create a new field with the fields entered as in the screenshot to the right.
  3. Find the new field ID. This bit's a little sneaky, but I can't think of a better way to do it. In the Extended Client Fields module, go to the main page that lists all your fields. You should see the new "expiry date" field. Roll your mouse over the "EDIT" link (or just click it). The URL for that page ends in edit.php?id=X. Jot down the value of "X" (it'll be an integer).
  4. Add an expiry date for a single client account. Edit one of your client accounts. You should now see your new field show up, like in the screenshot below.

    "Account Expiry Date" field
    Enter a date in the past, perhaps yesterday. Enter the date in this format: yyyy-mm-dd. It's very important that you enter the date in precisely that format: if you add a space at the end, reverse the month and days, don't zero pad the month or days or use a different separator than "-", this won't work!

So far so good. Now let's add a new Hooks Manager rule to examine the dates in that new field, and if the account expiry date has passed, prevent them from logging and display a "Sorry your account has expired message". If a client account doesn't have an expiry date set they can always log in like normal.