传递 WordPress 凭据不起作用。请协助

Passing WordPress credentials not Working. Please assist

在过去的几周里,我一直在苦苦挣扎,我需要寻求一些帮助。理论上这应该很简单。

我正在尝试为自定义登录系统创建 WordPress SSO。当用户登录到 WordPress 网站(或(更改密码或电子邮件)时,它将在用户通过 Wordpress 验证后启动 SSO 功能。

我的问题是哪个直接挂钩适合用于此任务以及哪些变量适合用于此任务。当来宾成功登录 Wordpress 时,它会使用与用户相同的凭据来验证自定义系统登录。

function custom_login() {
//## Function used to 'Auto' Login to Custom if user is accepted from WordPress.


    //## Check if user is signed on.
    if ( !is_user_logged_in() ) {

       //## User is Not Logged in, return 'false'
       return;

    }


    //## Assign Varibles (is this too risky?)
    //## Not sure if the $_POST['value'] will be the best way for this.
    $NewUserCred_username  = $_POST['log'];
    $NewUserCred_password  = $_POST['pwd'];


    //## Fire up Custom Validation. 
    //## Will set Custom Session if Successful.
    fireCustomLoginFunction($NewUserCred_username, $NewUserCred_password);


}


//## Maybe should run this during wp_signon or wp_login?
add_action( 'NOT SURE', 'custom_login' );

似乎 wp_signon 是一个以某种方式使用的方法,因为它包含我需要用来在它们被散列之前传递给函数的凭据,但那时用户尚未经过验证。自定义系统重新哈希信息以确保安全。

我的问题是哪个直接挂钩适合用于此任务以及哪些变量适合用于此任务。有任何想法吗?非常感谢任何反馈

:)

尝试

 add_action( 'after_setup_theme', 'custom_login', 100 );

function custom_login() {
   //## Function used to 'Auto' Login to Custom if user is accepted from WordPress.


//## Check if user is signed on.
if ( !is_user_logged_in() ) {

   //## User is Not Logged in, return 'false'
   return;

}


//## Assign Varibles (is this too risky?)
//## Not sure if the $_POST['value'] will be the best way for this.
$NewUserCred_username  = $_POST['user_login'];
$NewUserCred_password  = $_POST['user_email'];


//## Fire up Custom Validation. 
//## Will set Custom Session if Successful.
fireCustomLoginFunction($NewUserCred_username, $NewUserCred_password);


}