I am trying to integrate two websites build in wordpress and codeigniter. What I am trying to do here is is, I have user login in wordpress site. Here is the site. Now when the user logins here, and they access the dashboard, there is a navigation menu which will lead them to codeigniter site, which will be in the same host, say same folder or wherever it should be. When user clicks that navigation, they should be redirected to that site,and there user with the session in wordpress can only access. I read this, this and this but none meet my requirement. Can anyone tell me how can this be done.
EDIT This is what I did exactly, as far I could understand with my little knowledge from the reference of this answer. here
function wp_magic_quotes() {
// If already slashed, strip.
if ( get_magic_quotes_gpc() ) {
$_GET = stripslashes_deep( $_GET );
$_POST = stripslashes_deep( $_POST );
$_COOKIE = stripslashes_deep( $_COOKIE );
}
// Escape with wpdb.
$_GET = add_magic_quotes( $_GET );
$_POST = add_magic_quotes( $_POST );
// $_COOKIE = add_magic_quotes( $_COOKIE );
array_walk($_COOKIE, 'ci_ignore_magic_quotes');
$_SERVER = add_magic_quotes( $_SERVER );
// Force REQUEST to be GET + POST.
$_REQUEST = array_merge( $_GET, $_POST );
}
/** added by me
* Applies Magic Quotes to the $_COOKIE global but ignores Codeigniter's
Cookie
* @param string $value Value passed by array_walk function
* @param string $key Key passed by array_walk function
*/
function ci_ignore_magic_quotes($value,$key)
{
if($key != "ci_session")
{
stripslashes_deep($value);
}
}
And I simply printed this in ci controller;
public function index()
{
print_r($_SESSION);exit;
$this->load->view('welcome_message');
}
It is returning this:
Array ( [__ci_last_regenerate] => 1504085777 )
Is this what the things should had happen? I am trying to integrate this wp and ci for the very first time. So please help with whatever you can. Thanks.