There is a website on wordpress. There is a mysql database, it has a table with logins / passwords + more fields that work with the program on the computer. How to fasten this database or table to the site? so that when authorizing a user, the site takes a login / password from another database / table?
1 answer
Use the filter in functions.php .
add_filter( 'authenticate', 'filter_auth', 10, 3 ); function filter_auth( $user, $username, $password ){ // Проверьте имя и пароль по своей базе // Если успешно, надо создать объект WP_User и присвоить его переменной $user // Если неуспешно, надо создать объект WP_Error и присвоить его переменной $user return $user; } |
$wpdb2 = new wpdb( 'user', 'pass', 'name_bd', 'IP-server' );- Sergey Strelchenko