discuz! X plug-in development to determine whether the user login code how to write

Source: Internet
Author: User

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:

  1. if (Empty ($_g[' uid '))) {
  2. ShowMessage (' To_login ', ', ', Array (), Array (' showmsg ' = ' = ', ' login ' = 1));
  3. }
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.