Expirationdate v1.5

Release Notes

Provides a method to set an expiration date for entities and to delete
the entities after that date.  This plugin provides no user interface--it is
simply a helper plugin for other plugins.

** Usage **
Configure cron for Elgg as described in the Elgg documentation.

Install and enable the Expirationdate plugin.  Be sure to set the plugin's
period to something that will match nicely with your cron jobs.

Within your plugin, set entity expiration dates by saying:
        expirationdate_set($entity->guid, $expiration_date_string, bool);
Where $expiration_date_string is a valid strtotime() string.
If the 3rd parameter is true, the entity will be disabled instead of deleted.

Unset expiration dates by saying:
        expirationdate_unset($entity->guid);

Before entities are deleted the plugin_hook expirationdate:expirate_entity is
called with $param set as:
array(
        'entity' => entity object
)
If you register a function to this hook, the entity will not be deleted/disabled
unless the function returns true.

Each entity that has an expiration date will be passed through the plugin hook
expirationdate:will_expire_entity with the $param set as:
array(
        'expirationdate' => timestamp of expiration,
        'entity' => entity object
)
This can be used to send out warning emails, etc.

** Changes **

v1.5

        * Fixed a typo in the 15 minute cron.


v1.4
        * Correctly overriding the permissions instead of logging in the
                admin user.  (Thanks Kevin Jardine!)

v1.3
        * Added a check for expired entities before trying a foreach.

Brett

Elgg Core Developer

Stats

  • Category: Misc
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 2434
  • Recommendations: 0

Other Projects

View Brett's plugins