Ext.: http://www.bacysoft.cn/thread-71-1-1.html
discuz! X plug-in development to determine whether the user login code how to write?
When we develop plug-ins, we often need to determine whether the access user is a registered user, if it is allowed access, otherwise pop-up login window prompts the user to log in!
The code to implement this functionality is as follows:
- if (Empty ($_g[' uid '))) {
- ShowMessage (' To_login ', ', ', Array (), Array (' showmsg ' = ' = ', ' login ' = 1));
- }
Copy Code
$_g[' UID '] represents the ID number of the registered user, and if the user is already logged in, the variable is not empty!
By judging whether the $_g[' uid '] is empty to determine whether the user is logged in, if not logged in, then call ShowMessage Prompt user login or register!
discuz! X plug-in development to determine whether the user login code how to write