CodeIgniter Forums
Codeigniter with wordpress - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Codeigniter with wordpress (/showthread.php?tid=53921)



Codeigniter with wordpress - El Forum - 08-14-2012

[eluser]jamesduncan[/eluser]
Hi all,

Ive searched the forum and found some answers to this issue but trying to provide more specific info to potentially get some help

Im trying to set up a Codeigniter application with a Wordpress instill located in a subfolder

ie:

www (Codeigniter App)
-/blog (WP install in sub dir)


Ideally we want to have CI handle login and register (and user profiles) due to a number of specific business rules - this is all done already using Ion Auth

Then we'd like some specific published pages/content to come out of Wordpress - I have the WP JSON plugin installed but ideally I want to just use WP

The main question I have is how do I keep a user logged in when switching between both platforms - I dont know too much about CI or PHP sessions so any help on how to access them from within Wordpress would be helpful

ie: if user is logged in - show links in the header to their profile and show their username in WP - if not, links to our Ion Auth sign up page (in CI of course)

Cheers and thanks




Codeigniter with wordpress - El Forum - 08-14-2012

[eluser]jamesduncan[/eluser]
Ive been able to Google this post about doing it


http://www.indevcenter.com/2012/06/23/accessing-codeigniter-session-wordpress/#more-201


My question would be - do I drop the code suggested in the post into one of my WP theme PHP files? (basically like a CI view file)

Ive tried doing that and printing and echoing and getting no results

print_r($data);

or
print_r($_SESSION);

Cheers



Codeigniter with wordpress - El Forum - 08-14-2012

[eluser]jamesduncan[/eluser]
So Ive also discovered that Ion Auth handles some user info I need to access

http://stackoverflow.com/questions/9088008/codeigniter-ion-auth-trying-to-get-the-user-name-of-a-logged-in-user-in-to-a-str

So I guess the question is how do I access this session info from Ion Auth within a Wordpress install setup like Ive outlined about in my original question?

Thanks


Codeigniter with wordpress - El Forum - 08-17-2012

[eluser]jamesduncan[/eluser]
So Ive been able to get things working - I've just lost access to Wordpress's admin using this code below

http://www.thedaylightstudio.com/the-whiteboard/2010/06/16/codeigniter-and-wordpress-integration

But I'll keep trying to figure this out for anyone else.




Codeigniter with wordpress - El Forum - 08-17-2012

[eluser]Oscar Dias[/eluser]
Hey,
Nice sources, thanks for sharing... Once I managed to get the integration working the other way around, enablig CodeIgniter to use WP functions. In my case WP managed the users. If you want to take a look, my 'experiments' are online:
http://oscardias.com/development/php/codeigniter/integrating-wordpress-with-codeigniter/
Cheers