DOCUMENTATION

Search »

Hooks Manager

Step 2: Add code hook


"Account Expiry Date" code hook

In Form Tools, go to the Hooks Manager module and create a new hook. Enter in the values as shown in the screenshot. The most important parts are that it's a code hook, and it's assigned to the ft_login hook. What this means is that you're adding some code that gets executed during the ft_login core function - that's the function that handles logging in.

The code that's being added is shown below. It's actually pretty simple! All it does is examine the account information for the user trying to log in. If the account has an extended client field named "ecf_X" (extended client field X) and it has a value, it compares the current date with the date in that field. If the date has expired, then it redirects the user to the login page and outputs a message. The message that's displayed is customizable: just pass in a different query string for a different message (plain text only! Any HTML is automatically stripped out for security reasons).

Login account expired message
Login account expired message

Now trying entering different dates for the client account and try logging in. For client accounts whose accounts have expired you should see an error message like in the screenshot to the right.

And you're done! :)