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 Hook for page load

Development and Programming

mark186282's avatar
mark186282
290 posts
15 years ago
mark186282's avatar mark186282

Hi there,

I’m writing a quick extension to store some specific page load statistics, and I’m trying to find the right hook to use.

I tried sessions_start and sessions_end, but the member_id & session_id variables are not in the $SESS object (or the $input to the extension) at this point (in other words, these hooks appear to be called prior to those variables being set in the $SESS object)

what I really need is a “start page load” hook… I can’t seem to identify which hook to use.

Any advice?

Thank you -Mark

Moved to Development and Programming by Moderator

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
15 years ago
Sue Crocker's avatar Sue Crocker

Hi, Mark! Excellent question, but not something we answer in this particular forum. Moving to the Development forum for additional community support.

       
Rob Sanchez's avatar
Rob Sanchez
335 posts
15 years ago
Rob Sanchez's avatar Rob Sanchez

When calling sessions_end, the first parameter is the session object, you should be able to access member_id there.

//this is in my extension file
function sessions_end($obj)
{
    echo $obj->userdata['member_id'];
}
       
mark186282's avatar
mark186282
290 posts
15 years ago
mark186282's avatar mark186282

Excellent - thank you for that. The information seemed to be showing up as “guest”, but it was because my session was logged out.

sessions_end works perfectly.

thank you!

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
15 years ago
Sue Crocker's avatar Sue Crocker

Thanks for the assist, Rob!

       

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.