Jump to content

Topic on Project:Support desk

How to check if user views page (MW 1.39) ?

3
Stefahn (talkcontribs)

In my skin a certain component should only be rendered if people view the page. It should not be shown if people edit the page.

In MW 1.37 the following PHP code worked fine, but since 1.39 it no longer works.

Can someone point me in the right direction please?

global $mediaWiki;
( isset($mediaWiki) ) {
   if ( $mediaWiki->getAction() == "view" ) {
       ShowStuff();
   }
}
Malyacko (talkcontribs)
TheDJ (talkcontribs)

In many situations, you likely can use $this->getContext()->getActionName()

Reply to "How to check if user views page (MW 1.39) ?"