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

Content of $data for submit_new_entry_end - for trapping user changing status of entry via Edit on CP

Development and Programming

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

I am writing an extension for EE 1.x that will trigger an action (specifically, send email to members of a newsgroup) in the following scenarios: 1) when a new entry is published to a specified channel with status ‘open’ OR 2) when an existing entry in that channel is edited and its status field changed to ‘open’.

For the second scenario, I need to check the actual status field value of an entry undergoing edit from the control panel. Does the $data array contain $data[“entry_id”] ?

The first scenario 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’.

For the second scenario, also plan to use ‘submit_new_entry_end’ hook with testing $IN->GBL(‘C’) == ‘edit’ . I plan to query the database for exp_weblog_titles for that entry_id to fetch the current status of the entry. Is there an easier way or is this on-track?

Thanks, Aharon

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

Oops, $entry_id is the first parameter sent by the hook, so it is not contained in $data, which is the second parameter.

It would still be helpful to know the contents of the $data array, which keys it contains.

Aharon

       
chichilatte's avatar
chichilatte
43 posts
15 years ago
chichilatte's avatar chichilatte

you know about…

$whats_in_this_variable = print_r($data, true);

and…

error_log($whats_in_this_variable, 3, 'c:\path\to\where\you\want\a\log\file.txt');

super handy

       

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.