我有一个包含用户表的数据库,其中包含以下字段:id name email password status我的用户通过提供电子邮件和密码登录.我已经安装了一个有mysite.com/news路径的博客.我想要的是,如果某个用户在我的网站中注册,它...

我有一个包含用户表的数据库,其中包含以下字段:
id
name
email
password
status
我的用户通过提供电子邮件和密码登录.我已经安装了一个有mysite.com/news路径的博客.
我想要的是,如果某个用户在我的网站中注册,它应该在我的wordpress数据库中自动添加一行.我想获取我的用户表的所有记录并存储在wordpress用户表中.此外,如果有人登录我的网站,它应该在他们访问博客时登录.
解决方法:
为何重复这些信息?您还必须采取措施在两个数据库之间获得一致的用户管理.
我建议使用现有数据库作为WordPress的身份验证源,使用此插件:http://wordpress.org/extend/plugins/external-database-authentication/
更新:
要允许用户登录到WordPress,请在您的网站上登录时设置WordPress身份验证cookie.您可以通过包含所需的最低WordPress代码并调用wp_setcookie()函数来完成此操作.
// include the wordpress files necessary to run its functions
include('../classpages/wp-config.php'); // this includes wp-settings.php, which includes wp-db.php, which makes the database connection
include(ABSPATH . WPINC . '/pluggable-functions.php');
// use wordpress's function to create the login cookies
// this creates a cookie for the username and another for the hashed password, which wordpress reauthenticates each time we call its wp_get_current_user() function
wp_setcookie($user_login, $user_pass, false, '', '', $cookieuser);
从Using wordpress login functions开始
本文标题为:php – 将wordpress身份验证与现有用户数据库集成


基础教程推荐
- PHP-WordPress:从数据库中检索值 2023-10-08
- WordPress在其他PHP文件中使用wp_config.php变量连接到数据库 2023-10-08
- 64MB内存VPS安装Lighttpd-SQLite-PHP搭建WordPress博客教程 2023-10-08
- dedecms支付宝支付成功后发送邮件通知站长的方法 2023-07-09
- php – 如何在wordpress插件中获取会话变量 2023-10-08
- WordPress致命错误:在1832行的wp-includes / wp-db.php中,允许的内存大小为536870912字节(试图分配77个字节) 2023-10-08
- PbootCMS伪静态配置教程以及各web容器配置规则 2023-07-08
- 织梦dedecms首页列表页ajax无限下拉加载瀑布流效果 2022-06-23
- linux-使用wget在WordPress上进行身份验证 2023-10-08
- 【wordpress】wordpress插件之自动采集发布工具 2023-10-08