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

Code that is allways run

Development and Programming

EpicSoft's avatar
EpicSoft
64 posts
16 years ago
EpicSoft's avatar EpicSoft

What i am looking to do is run some code every time a page of the /system/ is loaded. If i could run it as soon as the user signs on or after every time the “Publish” button was used that would be ideal.

Basically set up like a cronjob but it wont run unless you sign on, post, or update an entry.

Anyone have an idea as to where i should put this code beside throwing an include(“foo.php” inside of system/index.php

       
Greg Salt's avatar
Greg Salt
3,988 posts
16 years ago
Greg Salt's avatar Greg Salt

Hi,

Have a look at any of the session_start,session_end, show_full_control_panel_end or show_full_control_panel_end extension hooks.

Cheers

Dry

       
EpicSoft's avatar
EpicSoft
64 posts
16 years ago
EpicSoft's avatar EpicSoft

Thanks i got it to work just too well. So well that once i enabled the extension my code is the ONLY thing that ran. After some digging in jquery i got a working example and got it working. Thanks for pointing me in the right direction.

Here is my solution just in case any oen else is looking for this.

in side your function activate_extension()

$DB->query($DB->insert_string('exp_extensions',
                                  array(
                                        'extension_id' => '',
                                        'class'        => "extension_name",
                                        'method'       => "shoulddothiswhenit_ends",
                                        'hook'         => "show_full_control_panel_end",
                                        'settings'     => "",
                                        'priority'     => 10,
                                        'version'      => $this->version,
                                        'enabled'      => "y"
                                      )
                                 )
              );

In side your class

function shoulddothiswhenit_ends($html)
    {
        return "foo bar ".$html;
    }
       

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.