Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [events]

The tag has no usage guidance.

1
vote
1answer
19 views

Solspace Calendar Event Editing

I'm using Solspace Calendar for Craft and I'm currently trying to implement the edit event form. Once a user selects an event on the calendar they are taken to the event page. On this page I have the ...
1
vote
1answer
62 views

Events documentation for Craft 3

I've been looking for an Event Reference doc for Craft 3 just like what we had for Craft 2, but couldn't find one. The only events doc I found for Craft 3 is the plugin updating guide: https://docs....
1
vote
1answer
37 views

How to change an entry's slug on EVENT_AFTER_SAVE_ELEMENT?

My entries' titles are auto-generated from several fields values on first save. When one of these fields values change, I would like to update the auto-generated slug also: <?php Event::on( \...
3
votes
1answer
92 views

Selling tickets to repeating events with Commerce (and Solspace Calendar?)

We need to build a ticketing system for venue tours, that happen every week within certain date ranges, and with an option to exclude specific dates from the availability list. Looking at Solspace ...
0
votes
0answers
8 views

No EVENT_DEFAULT_ORDER_STATUS in craft\commerce\services\LineItems?

The Commerce 2 docs shows LineItems::EVENT_DEFAULT_ORDER_STATUS as a parameter for the event beforeSaveLineItem and afterSaveLineItem, but craft\commerce\services\LineItems did not have a constant ...
1
vote
0answers
14 views

What are the replacements for the order events onBeforeAddToCart and onBeforeGatewayRequestSend in Commerce 2

I'm looking for replacements for the events onBeforeAddToCart and onBeforeGatewayRequestSend. I used onBeforeAddToCart to prevent the user from adding an article from different article groups to the ...
0
votes
1answer
43 views

How to reset a multi-value checkbox using EVENT_AFTER_SAVE_ELEMENT in Craft 3?

I'm porting the functionality of an existing plugin from another CMS into Craft 3 through a custom Craft module. The functionality is: When an option from a multi-value checkbox is checked on the "...
1
vote
1answer
153 views

How to modify and save a field in entry on EVENT_AFTER_SAVE in a plugin?

I'm trying to build my first little plugin. I'm stuck with a problem: I need to modify the value of the specific field reference, right after the saving of the entry because the new value is supposed ...
1
vote
2answers
63 views

Live Preview for Upcoming Entries

I have an Events section on my site, and to display upcoming and passed events (entries with a status of pending or expired) I manually set the entry in the template: Where the URL is /events/my-...
1
vote
1answer
42 views

Modify Order table in Control Panel

I need to add and/or change an attribute in the order table on /admin/commerce/orders. The Order Element itself does not have a EVENT_SET_TABLE_ATTRIBUTE_HTML, and I've tried with variations like ...
1
vote
0answers
18 views

Can't set structured entry parentId in BEFORE_SAVE event using field data

I have created an event that is called on beforeSave within my plugin. Code below: Event::on( Entry::class, Entry::EVENT_BEFORE_SAVE, function(ModelEvent $event){ /...
0
votes
0answers
57 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 ...
1
vote
1answer
27 views

Trigger download after form submission

I am working with a contact form plugin, written by an external developer several years ago. I want to trigger a file download upon successful completion of the form. As it stands, I have an onPost ...
1
vote
1answer
30 views

Is there an event that is triggered when an entry expires?

I would like to update an entry after it has expired via a plugin. Is there an event that I can use to do this when using Craft 2?
2
votes
1answer
89 views

How to get an entry url from EVENT_AFTER_SAVE_ELEMENT callback?

In my plugin I am registering a callback for Elements::EVENT_AFTER_SAVE_ELEMENT event. Previously, in Craft2, I could access the URL of the saved entry from the $event parameter passed into the ...
4
votes
2answers
767 views

User events in Craft 3

How do I capture user events in Craft 3? I looked at the documentation but couldn't figure it out. I need to capture after user registration events and after user save events. Here is what I tried, ...
2
votes
1answer
834 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 ...
1
vote
1answer
32 views

Charge Model “amount” and “userId” not always populated

I'm using the onCharge event to populate a separate purchases table that I can query elsewhere (combining both stripe and my other Paypal payments system). The onCharge event is mostly working, but ...
1
vote
1answer
120 views

Confirm Password on Set Password Form

Is there a way to send errors back to the set password form? I am listening to the users.onBeforeSetPassword event in which I want to confirm that the string in a confirm password field is the same ...
1
vote
0answers
105 views

commerce_orders onOrderComplete not triggered?

Problem: I want to trigger an action (Instant Analytics plugin) whenever a payment (Craft Commerce plugin) is successful (webhook). Payment provider is Mollie. So far I created a plugin that listens ...
1
vote
1answer
148 views

Unable to set error message in onBeforeDeleteUser

This is related to How to overrule Craft error messages with custom setError()? but I don't have enough rep to comment on it. I have a plugin that needs to check if a user is ok to be deleted before ...
1
vote
1answer
184 views

renaming a file in onBeforeSaveAsset won't work

I'm trying to rename a file before it is actually saved into Craft, by using the following code snippet in a plugin: craft()->on('assets.onBeforeSaveAsset', function(Event $event) { if($...
1
vote
1answer
72 views

Error when trying to send HTML email on event onActivateUser

Background: I'm working on a site that has frontend registration with some custom fields. The client would like to have a notification email whenever someone activates their account, containing the ...
1
vote
1answer
221 views

How to fire a custom event from another plugin?

I have some questions about events. I want to fire a custom event from another plugin. The event handler is in MyHelpers_PostService.php (plugin A). public function onSavePost(Event $event) { $...
2
votes
2answers
180 views

Modifying entry with 'onBeforeSaveEntry' event

I'm trying to modify a field on an entry before it is saved. What I'm trying to do is use a field from a linked entry to populate the same field on the entry being saved. From logging I know the ...
1
vote
0answers
65 views

Timezone drama for events calendar

Working on site where there is events calendar of conferences and webinars. Users are (literally) all over the world. Trying to figure out how I am going to handle time zones. Factors: - Fields I am ...
1
vote
2answers
33 views

onBeforeDeleteCategory not working / inconsistent

I need to run checks before allowing a user to delete a category. I have added the following code to my main plugin class: craft()->on('categories.onBeforeDeleteCategory', function(Event $event) { ...
1
vote
1answer
61 views

onBeforeSendEmail event triggered from Commerce_EmailsService

I'm trying to access the order and orderHistory model via onBeforeSendEmail event. I can see that in Commerce_EmailsService.php file on line 311 the event is created with those params and passed to ...
1
vote
1answer
181 views

entries.saveEntry not triggered by ResaveElements task

I've got a plugin that does a thing when an entry is resaved. It works great. However I need it to fire for every single entry to build some data. craft()->on('entries.saveEntry', function(Event $...
4
votes
1answer
60 views

Is it possible to create event with multiple date/time (out of box)

I have an event that runs from Monday to Sunday from 9am to 6am but on Thursday the time is from 9m to 8pm. How can I add repeat dates with diffrent time for Thursday?
4
votes
0answers
595 views

How to handle Craft 3 events in a plugin? Element API is returning null data

The below refers to Craft 3 and the Element API plugin for Craft 3. I would like to do something when the Element API plugin fires its onBeforeSendData event, I can see in the controller for element ...
1
vote
1answer
103 views

Venti Calendar URL

I have contacted support and looked in the usual places, it's the weekend so might not be till Monday that I hear back from support. Issue is that I cannot seem to get the URL right when displaying a ...
2
votes
2answers
80 views

What is the benefit of using a calendar event plugin or building your own?

I am looking at purchasing Venti 2 for events and also what it takes to build my own plugin. Does anyone know what kind of time it takes to build a plugin that does reoccurring dates, categories and ...
1
vote
1answer
76 views

Can a plugin manually raise another plugin's Event?

I have created an Adjuster which is attached to commerce_lineItems.onPopulateLineItem. The discount criteria is based on validation of a completely separate coupon API, so I created a permission-less ...
3
votes
1answer
328 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 ...
0
votes
1answer
237 views

How to create custom option/action for backend entry lists

Please excuse me for the title.. I have no idea how to describe my problem better - if someone knows a better description for this question feel free to edit it. I made a screenshot to clarify what I ...
2
votes
1answer
56 views

Get saved content of entry

I hooked up into the content.saveContent event. I want to save the entry content into a different application. Is there a way to retrieve the content as a Json (Or something more friendly). I think do ...
1
vote
1answer
194 views

Trouble calling a plugin's controller function from within an event listener function

I am working on extending the formbuilder2 plugin to call and pass the $event variable to a custom Controller after FormBuilder2 has initialized the "onBeforeSave" event within the FormBuilder2 ...
1
vote
1answer
132 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()-&...
4
votes
1answer
704 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 ...
2
votes
2answers
327 views

Event Listener for Publishing Scheduled Posts

For performance reasons I'm caching full HTML responses to Redis. This does wonders for response times, but cache invalidation becomes a bit tricky... I'm currently purging the entire cache on '...
1
vote
1answer
245 views

Create Solspace Calendar Event on Commerce onOrderComplete

I'd like to create a Solspace Calendar Event on Commerce onOrderComplete. I've done this with Charge where on Charge Success an event was created however I know that I did that in a less than ideal ...
3
votes
2answers
115 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
1answer
40 views

How should a multi-stage editorial process be implemented in Craft?

I'm building an editorial system on Craft which has 6-8 editorial stages, such as Assignment, Initial Proofing, Secondary Proofing, etc. It seems that the simplest solution would be to have the ...
3
votes
1answer
71 views

'onDeleteEntry' Event is not triggered when an Entry is deleted?

I have the following code: namespace Craft; class AffiliatesExportPlugin extends BasePlugin { //All other functions public function init() { craft()->on('entries.onDeleteEntry', function(...
2
votes
1answer
17 views

Close entry editing after set time (for certain a user group)

I have a group of users who are allowed to create entries and edit them but I want to put a window on how much time they have in which they can edit it. For example, after initial submission they ...
1
vote
1answer
96 views

What does the Before compile event inside the Contact Form plugin do?

I see there is an undocumented event called onBeforeMessageCompile in the Contact Form plugin source: Craft::import('plugins.contactform.events.ContactFormMessageEvent'); $event = new ...
1
vote
1answer
147 views

Sprout Forms `onSaveEntry` event

I need to add an event handler for the onSaveEntry event in order to integrate with another system. In the admin screens for the form where and how do I add this event handler?
16
votes
4answers
2k 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/...
2
votes
1answer
109 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 ...