Installation #
To install Published Event, follow these steps:
- Download & unzip the file and place the
publishedeventdirectory into yourcraft/pluginsdirectory - -OR- do a
git clone https://github.com/sjelfull/Craft-PublishedEvent.gitdirectly into yourcraft/pluginsfolder. 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
publishedeventfor 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.
Checking for published elements #
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
The publishedEvent.onPublished event #
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
});
}
}
Releases
- Improved: Cleanup
- Added: Added console command
- Improved: Renamed checkElements action to check
- Added: Initial release
Currently available for Craft consulting and custom plugin development
Contact me