We are facing very strange issue. We have big application with rails. In that application we just integrated the wordpress for bloging application.
We want a facility to show user information for logged in user(rails). So we want to use the rails application session in wordpress CMS.
Any ideas how can we achieve this.
I guess you could use cookies to share data between rails and PHP. You’ll have to configure the way the data is saved (as PHP may not correctly read Rails cookies, and vice versa). I believe you’ll find more precise information about this on the following article that seems to address your exact issue : http://www.coffeepowered.net/2011/08/24/rails-cookie-sessions-and-php/
Not sure about the security aspect of using cookies to store the whole bunch of user data though.
Hope this helps.
You won’t be able to access that in php but there are a few ways that you could do this.
iframe to a rails page – iframes are bad but would load the session inside rails.
you could do a request and send the ip or some other piece of information that wont change in too many cases. do an ajax or php request passing the ip as a param. check in rails if there is a session with that ip (you may need to modify the ip) and return some info.
obviously the shortfall here is that peoples ip’s may change.
Another possible solution is to store a key as a cookie that can be accessed by php and rails. write it with rails, read it with php and then request using ajac or curl the page from rails. This is probably the better solution.