Got a problem that I’m having a hard time getting started on. Not a big PHP guy so not sure where to start really.
What I have is this. I have a web application running on app.xxx.com this. This is our private application that all our customers use.
We are putting together a knowledge base in wordpress of how our software works, help files, etc… this is private information. For business reasons this wordpress runs on kb.xxx.com and must be there.
What I am doing currently is when a user authenticates at app.xxx.com I am setting a domain level cookie with some authentication information. This works great.
What I need to have happen is on the wordpress side of things if a user browses to kb.xxx.com and does NOT have our parent domain cookie, they are sent to a security error url somewhere. This has to happen server side, can’t do this in JS because its not secure enough.
What files would I edit in the wordpress install to do this kind of check for every request? Also how do I check for a parent level cookie in PHP.
Thanks in advance!
Try this WordPress Action
You can try this method. Just add the name of your cookie and add this code to your Functions.php file, located at the root of your theme file. If is not there you can just create one.
Paste code into your Functions.php file
Conclusion
WordPress has a great Action and Filter system which makes adding code easy as cake. By using the filters and actions you can keep your code nice and clean instead of throwing PHP all over your template files. This method will survive WordPress core updates as well. Which is the only way to go if your using WordPress.
Here’s the list of available actions for WordPress you can try instead of ‘template_redirect’:
http://codex.wordpress.org/Plugin_API/Action_Reference