简体   繁体   中英

How to check whether user logged in wordpress site from Yii?

In a my current project, I want to integrate a module done in Yii with a wordpress site. The user will login through the wordpress site and moved to the Yii section. I want to check from Yii, whether the user is logged in. Yii will be installed with in the root directory of wordpress and both the sites will hosted under same domain. like

http:://www.main-wp-site.com
http:://yiimodule.main-wp-site.com

Got the solution!! All I have to do is include the wp-load.php file in the index.php of Yii and after that, I will be able to use all the wordpress functions, including is_user_logged_in()

You can checkout the Wordpress Function reference here . The function you're looking for is is_user_logged_in() which returns true or false if the current user has a valid Wordpress login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM