Hello, I have built a small extension (my first one as well) that uses submit_new_entry_end to run an external script that populates a series of values into an external database table. The script appears to run fine from SAEF but when editing / updating from the control panel it ends with a white screen, does not go to the edit summary screen. Any suggestions on how to fix this issue?
Thank you -Tom
code is….
class gt_fastmatch
{
var $settings = array();
var $name = 'GT Fast Match';
var $version = '0.0.1';
var $description = 'Runs a fastMatch for both youth and jobs when saving a profile.';
var $settings_exist = 'n';
var $docs_url = "";
// CONSTRUCTOR
function gt_fastmatch ($settings = "")
{
$this->settings = $settings;
}
function startfastmatch($entry_id, $data, $ping_message)
{
global $DB;
$query = $DB->query("SELECT weblog_id FROM exp_weblog_data WHERE entry_id = '$entry_id'");
$weblogid = $query->row['weblog_id'];
if ($weblogid == '4')
{
include_once './notional/jobYouthMatching.php';
fastMatchJob($entry_id);
}
if ($weblogid == '2')
{
include_once './notional/jobYouthMatching.php';
$youth_query = $DB->query("SELECT field_id_4 FROM exp_weblog_data WHERE entry_id = '$entry_id'");
$youthID = $youth_query->row['field_id_4'];
fastMatchYouth($youthID);
}
return;
}
/**
* Activate extension
*/
function activate_extension()
{
global $DB;
$DB->query
($DB->insert_string(
'exp_extensions', array('extension_id' => '',
'class' => get_class($this),
'method' => "startfastmatch",
'hook' => "submit_new_entry_end",
'settings' => '',
'priority' => 10,
'version' => $this->version,
'enabled' => "y"
)
)
);
}
/**
* Disables the extension the extension and deletes settings from DB
*/
function disable_extension()
{
global $DB;
$DB->query("DELETE FROM exp_extensions WHERE class = '" . get_class($this) . "'");
}
/**
* Update extension
*/
function update_extension ($current = '')
{
global $DB;
if ($current == '' OR $current == $this->version) return FALSE;
$DB->query("UPDATE exp_extensions SET version = '".$DB->escape_str($this->version)."' WHERE class = '".get_class($this)."'");
}
// END
}[Mod Edit: Moved to the Extensions forum]
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.