We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE 2.0: Reacting to publish/edit in a channel — Which hook to use?

Development and Programming

akchas's avatar
akchas
1 posts
15 years ago
akchas's avatar akchas

In my EE 2.0 site, I have a channel called “people,” with a boolean field called “featured.” Only one person from the “people” table can be the featured person at any given time.

My goal: If I’m creating a new person or editing an existing one, and I check the “featured” checkbox, then upon saving that record, all of the other people already saved in the channel should have their “featured” status set to 0. (Of course, this change should only affect one record at most.)

It seems like an extension is the best way to achieve this. (Please correct me if I’m wrong about that.) I’ve been searching all over, but I can’t figure out which hook to use, to insert post-processing logic when a channel entry (new or existing) is saved.

• If I use “foreign_character_conversion_array,” it fires whenever the control panel loads – not just when I hit save. • If I use “entry_submission_end,” it doesn’t seem to fire at all – even when saving an entry.

Am I going about this the right way? And if so, which hook should I be using?

Thanks, Charles

       
akchas's avatar
akchas
1 posts
15 years ago
akchas's avatar akchas

For anyone else struggling to figure this out, I eventually got it working. The “entry_submission_end” hook does fire after all. Not sure why it seemed not to work before…

       
grenadir's avatar
grenadir
9 posts
15 years ago
grenadir's avatar grenadir

In EE 1.x, I want to trigger an action (specifically, send email to members of a newsgroup) when a new entry is published to a specified channel with status ‘open’ or when an existing entry is edited and its status field changed to ‘open’. What hooks should I use in writing the extension, and how can I check the former status and the new status of an entry undergoing edit?

The newly published article can be trapped using the ‘submit_new_entry_end’ hook and I can test $data[“weblog_id”] and $data[“status”] and test $IN->GBL(‘C’) == ‘publish’. What do I do to trap the edited entry whose status is being changed to ‘open’?

Thanks, Aharon

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.