Welcome Guest, Not a member yet? Register   Sign In
how to share SESSION with WP
#1
Question 
(This post was last modified: 03-27-2018, 02:59 AM by ardavan.)

Hi, everybody,

I'm working on a microsite in CI and this microsite will generate some session data.
on the same Host & domain, we have another website with is WordPress.

I would like to make use of CI session generate in Wordpress website. Confused

example:
set on CI
PHP Code:
// http://www.website.com/cp/
$this->session->set_userdata('some_name''some_value'); 

call it on WP header.php
PHP Code:
// http://www.website.com/ 
$_SESSION['some_name']; //some_value 

Is it possible to do so?  Huh
Please show me the correct approach.  Smile

Thanks in advance
Reply
#2

You would need to edit and change every WordPress file that used sessions

So personally I would not recommend it at all.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

isn't possible to just check that session in header.php in WordPress?

so if i must edut every WP file that used session, how can be possible? could you show some demo code?
Reply
#4

Hi Ardavan,
I've done the opposite way, I've utilized the Wordpress login and sessions, and then referenced the sessions on the CI side.
It works, but it pulls in more of the wordpress side functionality than I would like, and you have to be careful when Wordpress major updates happen. If that is of interest to you, let me know.
Bob

(03-26-2018, 02:19 AM)ardavan Wrote: Hi, everybody,

I'm working on a microsite in CI and this microsite will generate some session data.
on the same Host & domain, we have another website with is WordPress.

I would like to make use of CI session generate in Wordpress website. Confused

Is it possible to do so?  Huh
Please show me the correct approach.  Smile

Thanks in advance
Reply
#5

(This post was last modified: 03-27-2018, 02:55 AM by ardavan.)

Hey Bob, thanks for your reply,
So if you have done the opposite way, that means I can do another way around.
basically, my microsite is a user management for the WordPress website and will generate some session that can use in the WordPress(of course there will be some hard coding in the WordPress header.php).

My question is if the session works on a domain, so I can get the session in a plain PHP code right?

what I am thinking is to generate a session in plain PHP (in the microsite - CI) and then call that session in plain PHP (in the WordPress - header.php)

set on CI
PHP Code:
// http://www.website.com/cp/
$this->session->set_userdata('some_name''some_value'); 

call it on WP header.php
PHP Code:
// http://www.website.com/ 
$_SESSION['some_name']; //some_value 

how can I do this? I mean that is my first time and idk how to make this to happen.

any idea?

(03-26-2018, 08:38 PM)visualsol Wrote: Hi Ardavan,
I've done the opposite way, I've utilized the Wordpress login and sessions and then referenced the sessions on the CI side.
It works, but it pulls in more of the WordPress side functionality than I would like, and you have to be careful when Wordpress major updates happen.  If that is of interest to you, let me know.
Bob

(03-26-2018, 02:19 AM)ardavan Wrote: Hi, everybody,

I'm working on a microsite in CI and this microsite will generate some session data.
on the same Host & domain, we have another website with is WordPress.

I would like to make use of CI session generate in Wordpress website. Confused

Is it possible to do so?  Huh
Please show me the correct approach.  Smile

Thanks in advance
Reply




Theme © iAndrew 2016 - Forum software by © MyBB