[英]Wordpress- Popup a registration form on a custom template based on whether user logged in or not
Basically I have a custom page template and when users visit that page I want to check whether he/she is logged in or not. 基本上,我有一个自定义页面模板,当用户访问该页面时,我想检查他/她是否已登录。 If logged in then fine else generate a popup form for registration.
如果登录,则可以,否则生成一个弹出表格进行注册。
<?php global $current_user;
get_currentuserinfo();
if($current_user->ID == '')
//Generate a popup......
?>
I would be obliged if anybody can guide me how to do it. 如果有人可以指导我怎么做,我将有义务。
This should do it, 这应该做到的
if ( is_user_logged_in() ) {
//$current_user = wp_get_current_user();
//echo 'Hi '.$current_user->user_firstname;
} else {
//Code for Popup etc
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.