Sessions hook issue in ExpressionEngine Extension

I was creating a custom extension of expressionengine 1.6.x version where i tried to use sessions_start and sessions_end hooks but i was facing problem with $SESS global var, it was not loaded to extension method. The method was something like –

function do_something(){
	global $SESS;
	
	print_r($SESS);
}		

I wasted about 1/2 hours with this but no clue why this happened. Later i saw that, this hook is called with instantiated object(session) $this as parameter, so later i defined that function as –

function do_something($sess){
	print_r($sess);
}		

It solved and shows session data. Its very easy but sometime time wasting issue. Hope this will help EE community.

Advertisements

One thought on “Sessions hook issue in ExpressionEngine Extension

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s