1

I'm making a custom extension to add a channel entry's data to another remote database, but I only want to do this with certain channel(s).

How do I check inside my extension hook what channel the entry is being published in?

/**
* Adds new EE product to Infusionsoft products table.
*
* @return bool
*/
public function entry_submission_absolute_end() {

    // if the channel being published is "products", continue..


    // get the product details from the channel entry form
    $newRow = array(
        'ProductName' => '',
        'Description' => '',
        'ProductPrice' => ''
    );

    // add the new row(product) to the infusionsoft db
    if ($this->app->dsAdd('Product', $newRow)) {
        return true;
    }

} // END
1

The hook gets called with several parameters that you can add to your extension:

public function entry_submission_absolute_end($entry_id, $meta, $data, $view_url) {
  if ($meta['channel_id'] == 7) {
    // do your code here

See http://ellislab.com/expressionengine/user-guide/development/extension_hooks/cp/content_publish/index.html#entry_submission_absolute_end

1
  • Thank you so much! This was perfect and worked as expected.
    – Maggie B.
    Jul 8 '14 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.