Questions tagged [events]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
2answers
295 views

Delete / change Status from CP via Ajax (trigger event)

In a plugin init function I'm listening to entries.saveEntry and entries.deleteEntry. This works perfectly if I'm editing entries from their detail view. If I 'bulk' change or delete entries, these ...
3
votes
2answers
143 views

Fire event first time future dated entry goes 'live' from 'pending'

Is there a way I can run some code from a plugin when a future dated entry goes 'live' from 'pending'? I am trying to send an email update that a new entry has been posted. The related post below ...
1
vote
2answers
730 views

How to log info from an onSaveEntry event?

Having problems logging to the console using log from within an onSaveEntry or onSaveUser event. Just a simple test below, but will be critical for error logs. public function init() { parent::...
15
votes
4answers
3k views

Events calendar for Craft - which one should I use?

The current state of events/calendars in Craft is: Calendars - https://topshelfcraft.com/calendars/introduction Venti - http://tippingmedia.com/venti Solspace Calendar - https://solspace.com/craft/...
10
votes
2answers
1k views

Booking paid-for events: How?

First off, I appreciate this is open ended and SE isn't the best place for it. For a lack of a better place to ask though, here we are: I've just built a system for a client where users could sign up ...
5
votes
1answer
1k views

Bulk resave entries to trigger onSaveEntry event

I have a site with a hundred+ or so entries. I've added a new field to my entry template, but it won't take effect until it's been activated by a onSaveEntry event. I've gone through maybe 15 ...
5
votes
1answer
646 views

Can a plugin fire a custom event?

I have PluginA that needs to listen for something that PluginB does. PluginB needs to include a Model in the event data so that PluginA (and any other subscriber) can pick that up and do whatever it ...
2
votes
2answers
960 views

How can I pass variables to email's template onBeforeSendEmail

I'm trying to add some variables to email's template to be rendered before email is sent. I was able to modify emailModel like customHeaders and subject but I couldn't pass custom variables to the ...
3
votes
2answers
386 views

EVENT_AFTER_SAVE_ELEMENT triggered twice after saving an entry

I had this weird issue, not sure if that happens to you guys or not. I'm trying to catch the 'after entry is saved' event, using the following code in my custom module's init() function (The module's ...
1
vote
2answers
391 views

Rename a file using onSaveEntry event

craft()->on('entries.saveEntry', function(Event $event) { // entry slug, will be used as image name $EntryTitle = $event->params['entry']['slug']; // Get attached image $entry = ...
4
votes
1answer
677 views

How do you raise/fake an event so that you can test handlers listening for it?

We use event integration (native and custom) in a lot of the plugins we build and I was wondering if anyone has come up with a simple way to raise those events at will, without having to follow a ...
2
votes
1answer
2k views

How to saveElement in EVENT_AFTER_SAVE_ELEMENT without infinite loop

I am trying to update an entry's title in a Craft 3 module after an entry is saved. I cannot use EVENT_BEFORE_SAVE_ELEMENT because the title gets updated after this. If I use EVENT_AFTER_SAVE_ELEMENT ...
2
votes
1answer
123 views

Checking for first time an entry is “published” i.e. saved with a Live status

Is there a way, via an Event or otherwise, to catch the first time a post is saved and isn't in disabled mode? I want to send out an email alert to users when a new entry is published, but I want it ...
4
votes
1answer
274 views

Is it possible to listen for Yii events?

I want to listen for Yii events like onBeginRequest and onEndRequest. I've tried the following but nothing happens :( \Yii::app()->onBeginRequest = create_function('$event', 'die ("YO") ;'); and ...
3
votes
1answer
354 views

Programatically change a lightswitch value on an entry on save

I have a simple plugin that fires some events entries.onSaveEntry based on if a lightswitch is turned on with that entry. What I would like to do as the last event in my plugin would be updating the ...
2
votes
1answer
130 views

What is the best way to handle Events that get triggered during a migration?

We have a Form plugin and an Email plugin. Users can setup the Email Plugin to send off notification emails when a particular Event happens. Some users setup a notification email to be sent when a ...
2
votes
1answer
427 views

How to overrule Craft error messages with custom setError()?

I know I can set errors and notices in the CP with setError() and setNotice(). But it gets overruled by the default error message in my event. I have a beforeDeleteEntry event which stops the ...
1
vote
1answer
133 views

Handling Endless Recursion in saveEntry?

I'm trying to update the expiry field—based on an existing field (in this case classDate)—as soon as an entry is saved. Based on this answer, the clever recursion code in carlcs' Auto Expire plugin, ...
1
vote
1answer
189 views

entries.onSaveEntry does not fire from frontend

I created my own actionEntrySave for my frontend form. and I'm using the $entryService->saveEntry($entry); method to store my entries into the database.The problem is this does not fire craft()-&...
0
votes
0answers
154 views

How to exclude some fields from the searchindex using the RegisterElementSearchableAttributesEvent event?

Context I had big issues on a Craft 2 multilingual site with dozens of thousands of entries that were using Matrix fields. The site had become extremely slow (almost unusable), especially when ...