Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session_start for plugin?
#1
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..
Reply
#2
(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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
You can use session_name to use unique sessions
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
thanks mvlcek & shawn, i will give it a try..
although I'm still new to GS, I am very interested to learn more.
Reply




Users browsing this thread: 1 Guest(s)