### Module hooks

Classified Ads defines three notification hooks, which a module can implement to notify users of the impending or occurred expiration or purge of their ads.

- `hook_classified_expire_alter(array $ads);` is invoked right after Classified Ads has expired a number of ads.
- `hook_classified_notify_alter(array $ads, $kind);` is invoked when any ad has reached a given point in its life cycle. `$kind` indicates which point this is.
  - half-life: the ads in the `$ads` array have only half of their lifetime remaining
  - pre-expire: the ads in the `$ads` array will expire on the next day
  - pre-purge; the ads in the `$ads` array will be purged from the site on the next day
- `hook_classified_purge_alter(array $ads);` is invoked right after Classified Ads has purged a number of ads.

For an implementation example, look into function `classified_notifications_classified_purge_alter()` in file `classsified_notifiaction.module`.

Note that, although these are "alter" hooks, modification of the `$ads` array has no impact on the actions performed by Classified Ads: they will only affect other modules with a higher weight also implementing the same hook.

### Format of the `$ads` array

The three hooks receive an array in the same format:

    $data =  array(
      uid1 => array(
        nid11 => title11,
        nid12 => title12,
        nid... => title...,
      ),
      uid2 => array(
        nid21 => title21,
        nid22 => title22,
        nid... => title...,
      ),
      uid... => array(
        nid... => title...,
      ),
    );