When building a website template, it is sometimes necessary to judge whether a user logs in or whether an administrator logs in. This is not a tutorial, but it is used occasionally. Baidu later saw that Tianxing and Fengyan Blogs have this tutorial, and make a record of their arrival in case of emergency.

 Zblogphp judges user login.jpg

Judge whether the user logs in

 {if $user.ID>0}                            <!-- Judge whether the user ID is greater than 0 (the registered user ID will be greater than 0... --> Welcome: {$zbp ->user ->StaticName}<-- Here is the content displayed after the user logs in --> {else} <a href="{$host}? Reg">Register</a><-- Here is the content displayed when the user has not logged in --> {/if}

Example:

 {if $user. ID>0} The logged in user can see me! {else} Seeing me means you haven't logged in yet! {/if}

Judge user level

View different content according to different user levels:

ZBlog user level division:

1 ->Administrator

2 ->Website editing

3 ->Author

4 ->Collaborators

5 ->Reviewers

6 ->Tourists

Example 1:

 {if $user.Level < 2} Only administrators above can see it! {/if}

Example 2:

 {if $user.Level == 1} Only administrators can see! {/if}



    Comment List (Already six Of comments four thousand nine hundred and fifteen Participation) Participate in the discussion
     Netizen nickname: visitor
    visitor tourist 5F
    2019-03-07 reply
    Test reply alias
     Netizen nickname: test reply alias
    Test reply alias tourist 4th floor
    2017-07-17 reply
    Test reply alias
     Netizen nickname: 65
    sixty-five tourist floor
    2017-07-01 reply
    Hello, I have been following your website for a long time, and I think your website is very interesting. I hope to exchange links with your website. If you are interested, welcome to my website http://www.yuedudg.cn Leaving a message.
     Netizen nickname: cross-border e-commerce training
    2017-07-03 reply
    @ 65 Support...
     Netizen nickname: 591ARVR Information Station
    2017-06-29 reply
    Walk by with support
     Netizen nickname: leek
    Chives tourist sofa
    2017-06-25 reply
    Come and learn! Supported~