2014-12-02 78 views
0

我有兩個門戶之一是jsp和另一個是wordpress,我試圖爲兩個門戶網站進行通用登錄(即當用戶從jsp登錄在相同他還需要登錄wordpress)。所以我寫的婁代碼WordPress的(wp_signon)把我當作未登錄用戶

$creds['user_login'] =$userid[0]; 
    $creds['user_password'] = $user_password; 
    $creds['remember'] = true; 
    $user = wp_signon($creds, false); 
     // print_r($user); 
    if (is_wp_error($user)){ 
     echo $user->get_error_message(); 
}else{ 
//echo $user->ID.'dd'; 
get_currentuserinfo($user->ID); 
$user_id = $user->ID; 
$user = get_user_by('id', $user_id); 
if($user) { 
    wp_set_current_user($user_id, $user->user_login); 
    wp_set_auth_cookie($user_id); 
    do_action('wp_login', $user->user_login); 
} 
global $current_user; 
     get_currentuserinfo(); 

     //echo 'Username: ' . $current_user->user_login . "\n"; 

與上面的代碼,我可以能夠得到登錄用戶的詳細信息...但是當我嘗試去管理它是要求登錄憑據

+0

你路過管理員登錄細節$用戶ID? – 2014-12-02 11:28:10

+0

它是爲用戶...所以iam傳遞用戶的詳細信息 – 2014-12-02 12:40:11

回答

相關問題