Welcome Guest, Not a member yet? Register   Sign In
CI and WordPress
#1

[eluser]phpmonster[/eluser]
I am using WordPress as a cms but have build a CI dashboard for financial stuff that users will use to login on. (they will not use WordPress login)

I'd like to be able to show if someone is logged in on my CI app within WordPress templates.

I have:

- WordPress in the root
- CI is installed in the /APP/ folder in the root.
- Both on same domain.
- Will be using also the CI cart class, so I'd like to show the products in basket in wp templates.

How do I get them to talk, is there a way I can instantiate CI and run with it in WP?
I have Googled and came across several 'solutions' none worked out. The most potent was one from https://bitbucket.org/daylight/ci-wordpr...r/overview but could not get it to work. I think there might have been a .htaccess routing issue.

Any help would be appreciated.
#2

[eluser]pickupman[/eluser]
I've used both on the same domain, but have not integrated them. The close as the integration was caching the wordpress home page to convert into my CI template. That was before things like PyroCMS existed. If I were doing something similar to you now, I would likely start with PyroCMS and build onto it. CI is great, but why not just create a WP plugin if you are tied into tightly.

You probably just need to have created a 2nd DB connection for CI to connect to the WP database or share the same database. Just make sure you are namespacing your table names. If sharing a database, in your template, query the database for user sessions from the CI table.

Again, both are PHP and MySQL, so you can accomplish anything you want.
#3

[eluser]phpmonster[/eluser]
Thanks for your reply.

I managed to connect to the CI db from WordPress and execute queries, however I'm using ion_auth and the userdata I need is stored in the ci_sessions user_data column with the following format:

a:5:{s:5:"email";s:19:"[email protected]";s:2:"id";s:1:"2";s:7:"user_id";s:1:"2";s:8:"group_id";s:1:"2";s:5:"group";s:7:"members";}

What format is this and how do I loop trough this.
#4

[eluser]skunkbad[/eluser]
[quote author="phpmonster" date="1301296560"]Thanks for your reply.

I managed to connect to the CI db from WordPress and execute queries, however I'm using ion_auth and the userdata I need is stored in the ci_sessions user_data column with the following format:

a:5:{s:5:"email";s:19:"[email protected]";s:2:"id";s:1:"2";s:7:"user_id";s:1:"2";s:8:"group_id";s:1:"2";s:5:"group";s:7:"members";}

What format is this and how do I loop trough this.[/quote]

That is a serialized array. Just unserialize it, and you will have a normal array.




Theme © iAndrew 2016 - Forum software by © MyBB