How to check if user is Sysop using Php in Mediawiki?

后端 未结 2 476
醉话见心
醉话见心 2021-01-21 00:12

I am trying to add a div to my sidebar and I only want this block to show to administrators. How can I check if a user is an administrator in php? I am trying to add this to mys

2条回答
  •  再見小時候
    2021-01-21 00:55

    I think I got it. I added the following to my skin template to add special conditions for sysops and non sysops:

         isAllowed('protect')) {
             // if sysop
                echo 'Hello People';
            }
    
            else {
                echo 'Yo';
            }
          ?>            
    

    I got the idea from here: Check if user is sysop

    If there is a better way to do this, please do let me know. But so far, the above seems to work when I added that code to the basetemplate of my skin.

提交回复
热议问题