2016-11-10 187 views
0

首先对不起我的英语重定向后,登录定制登录页面WP

我有重定向时,他是连接的用户的问题,我做的是一个自定义登录页面上(模式)

当我把提交

我把这个代码connexion.php

<?php 
define('WP_USE_THEMES', false); 
require_once('../../../../wp-load.php'); 
global $qode_options_theme16; 
global $wp_query; 
global $wpdb; 

// using ldap bind 
$ldaprdn = "cn=gazano,dc=cerpweb,dc=local";  // ldap rdn or dn 
$ldappass = "test"; // associated password 

// connect to ldap server 
$ldapconn = ldap_connect("192.168.209.7","389") 
    or die("Could not connect to LDAP server."); 

ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); 


if ($ldapconn) { 

    // binding to ldap server 
    $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); 

    // verify binding 
    if ($ldapbind) { 
     echo "LDAP bind successful..."; 
     $mdp = wp_hash_password('cerpcerp'); 

     $wpdb->query("INSERT INTO wp_users (user_login,user_pass, user_nicename, user_email, user_url, user_activation_key, user_status,display_name) VALUES ('hjhjh', '$mdp','e51511','[email protected]','15d15','ertre','0','jhjh')"); 

     $user=wp_authenticate('hjhjh', 'cerpcerp'); 

     $ie=wp_redirect(home_url()); 

     my_login_redirect($ie,' ', '1'); 


    } else { 
     echo "LDAP bind failed..."; 
    } 

} 

?> 

我的LDAP正常工作,我的工作插入,以及和我的wp_authenticate( 'hjhjh', 'cerpcerp');作品也,

,但问题是在my_login_redirect($即,””, '1')

在家里重定向工作正常,但没有联接...

,并在我的header.php一个把这个一个

global $current_user; 
$current_user = wp_get_current_user(); 

有人能帮助我

预先感谢

回答

1

至于我记得你需要退出()wp_redirect之后。

也有一些过滤器为你解答做​​

add_filter('login_redirect', 'my_login_redirect', 10, 3); 
+0

感谢,但它确实NT工作,因为IMA有点脏对不起,我学习, – weymeels

+0

此页面ISN t时的function.php页面,但connexion.php这是一个自定义的页面,我把这个页面模式页面的按钮,我不使用function.php,因为我不知道如何做到这一点的代码 – weymeels

+0

没有啊:d它的作品:d谢谢Benoti – weymeels