从我的网站登录到wordpress网站 [英] Login to wordpress site from my site

查看:88
本文介绍了从我的网站登录到wordpress网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在使用Zend Framework开发的网站.我在同一台服务器上也有一个Wordpress网站.当我登录到Zend网站时,是否可以使用任何(例如:AJAX呼叫)登录到Wordpress网站.

I have a website which is being developed using Zend Framework. I also have a Wordpress site placed on the same server. Is it possible to login to Wordpress site using any (e:g AJAX call) when i login to my Zend site.

原因:

Reason:

我在Zend网站上有一个指向word press博客的链接,当我单击该链接时,它将带我到Wordpress登录页面.

I have a link to word press blog on Zend site, and when i click on that link, it takes me to Wordpress login page.

我希望该用户以登录用户的身份进入Word Press Blog页面链接.

I want the user to be taken to word press blog page link as a logged in user.

我对此进行了很多研究,但没有找到正确的路径.

I researched a lot on this, but not finding the correct path.

谢谢.

推荐答案

由于两个站点都在同一台服务器上,因此可以从Zend和WordPress访问文件.当用户登录到基于Zend的站点时,可以添加一个调用以加载基本的wordpress文件,然后使用功能wp_set_auth_cookie()将用户登录到wordpress.

Since both sites are on the same server, presumable you can access files form both Zend and WordPress. When you user is loggin into Zend based site, you can add a call to load basic wordpress files, and then use the function wp_set_auth_cookie() to log the user into wordpress.

require_once 'wordpress-directory/wp-load.php';
wp_set_auth_cookie( $wp_user_id );

在Zend网站上的users表中,您可以有一个附加列wp_user_id来存储用户的wordpress用户ID,以便您知道要通过wp_set_auth_cookie()函数的用户ID.

In your users table on your Zend site, you could have an additional column wp_user_id to store the wordpress user id's for your users, so that you know what user id to pass the wp_set_auth_cookie() function.

如果您也想检阅此处

这篇关于从我的网站登录到wordpress网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆