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

extension using submit_new_entry_end results in blank cp on entry and edit

Development and Programming

tsublewski's avatar
tsublewski
1 posts
about 16 years ago
tsublewski's avatar tsublewski

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]

       

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.