Posts: 9
Threads: 3
Joined: Mar 2013
I want to create my own simple plugin with their own CRUD administration backend. I tried to embed (php way) it in GS backend. It requires session_start() init before the plugin page backend loading.
My Question is:
1. Where is the right place to put session_start() based on my case
is it okay by using this? add_action('admin-pre-header', 'forms_init');
or is there any other way?
2. What is the session name for backend? I ask this cause i need to check whether the user has an authenticated admin session or not.
thanks..
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-04-16, 03:31:00)whiteh0rs3 Wrote: I want to create my own simple plugin with their own CRUD administration backend. I tried to embed (php way) it in GS backend. It requires session_start() init before the plugin page backend loading.
My Question is:
1. Where is the right place to put session_start() based on my case
is it okay by using this? add_action('admin-pre-header', 'forms_init');
or is there any other way?
2. What is the session name for backend? I ask this cause i need to check whether the user has an authenticated admin session or not.
thanks..
If you embed your administration backend as plugin in the getsimple backend, you will always be authenticated, when your plugin is called.
Otherwise (e.g. for AJAX requests) you can check with
Code:
$loggedIn = cookie_check();
GetSimple does not use sessions, but only cookies. If you use sessions yourself you might experience problems with other plugins. Try to not use sessions.
If you really need to use sessions,
admin_pre_header would be the hook. Make sure to put your session_start in a try/catch, as another plugin might have called it before.
Posts: 6,266
Threads: 181
Joined: Sep 2011
You can use session_name to use unique sessions
Posts: 9
Threads: 3
Joined: Mar 2013
thanks mvlcek & shawn, i will give it a try..
although I'm still new to GS, I am very interested to learn more.