[EXTENSION] PcLimitEditTimePeriod

This extension enables limiting the ‘update’ action (or any action, actually) or a model to a certain timeframe after the creation of that model. This is a common practice in many sites (e.g., LinkedIn, in the ‘groups’).


  • Two main modes of operation (provided by two different methods):[list]
  • ‘All included’ mode: In which when the configurable time period has passed this behavior will intervene the normal operation flow by calling the controller’s render() with a predefined view file to show a customizable ‘edit period expired’ message. This mode requires as little as possible changes required on the controller/model classes.
  • ‘Just advise’ mode: This mode is used to only advise the client code if edit is allowed or not. No rendering or anything is done. This allows for greater flexibility and customizing of workflow via your code.

[]Configurable ‘edit timeout’ per model class, with a default of 60 min.[]Supports two formats for ‘created on’ value in the AR model - int (typical when using unix timestamps) or a string that can be used to initialize a DateTime object (supported formats: http://php.net/manual/en/datetime.formats.php).[]Customizable ‘created on’ attribute name per model class.[]Can use logging. This is configurable. Default = yes, will use logging.[*]Customizable ‘edit period expired’ message per model class. This is useful if one class requires specific notification message shown to the user. This is relevant only in ‘all included’ mode (see above).[/list]

You’re invited to check it out, here.