Triggers a event for elements that was enabled at a given time.
To install Published Event, follow these steps:
- Download & unzip the file and place the
publishedevent
directory into yourcraft/plugins
directory - -OR- do a
git clone https://github.com/sjelfull/Craft-PublishedEvent.git
directly into yourcraft/plugins
folder. You can then update it withgit pull
- -OR- install with Composer via
composer require sjelfull/publishedevent
- Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
publishedevent
for Craft to see it. GitHub recently started appending-master
(the branch name) to the name of the folder for zip file downloads.
Published event works on Craft 2.4.x and Craft 2.5.x.
To check for any elements that has been published, you have to run either the console command or controller action at the interval you need, for example from a cron job.
Run ./craft/app/etc/console/yiic publishedEvent
OR
Make a request to the action publishedEvent/check
:
curl --silent http://example.com/actions/publishedEvent/check
Other plugins can be notified when a pending entry has been published.
class SomePlugin extends BasePlugin
{
// ...
public function init()
{
craft()->on('publishedEvent.onPublished', function (PublishedEvent $event) {
$entry = $event->params['entry'];
// Do something with the $entry
});
}
}
- Cleanup
- Added console command
- Renamed checkElements action to check
- Initial release
Brought to you by Fred Carlsen