Wordpress Autologin Plugin not working on server

Posted by Nishant on Stack Overflow See other posts from Stack Overflow or by Nishant
Published on 2010-04-06T11:03:26Z Indexed on 2010/04/07 1:33 UTC
Read the original article Hit count: 466

Hello Everyone, I have been busy integrating Wordpress to one of a CakePHP application.Last Monday I cracked the way to integrate it.Now another problem I faced was that Client wanted to auto login the users who are login in CakePHP side,I did that too and it works fine in local.I am using the Session Variable of CakePHP which is set in core.php of cakephp,in the Wordpress also.The Code snippet of the Auto Login plugin is : -

session_name("Cake_PHP_Session_Vars");
session_start();
function auto_login(){if (!is_user_logged_in()) {
    //determine WordPress user account to impersonate
    $user_login = 'guest';

   //get user's ID
    $sessVars = $_SESSION['User'];
    $user_id = $sessVars['id'];

    //login
    wp_set_current_user($user_id, $user_login);
    wp_set_auth_cookie($user_id);
    do_action('wp_login', $user_login);
}}add_action('init', 'auto_login');

It all works fine on the Local system but when I am putting it on Server,It is not working out.Please suggest me what could be the problem here. Thanks In Advance

© Stack Overflow or respective owner

Related posts about integration

Related posts about cakephp