Topic on Manual talk:How to debug/Login problems

Extension development

3
Loizbec (talkcontribs)

Hi, I'm developing for my own needs an extension that allows to show different content based on whether the user is logged in or not. I don't think it's mature enough to be distributed yet :(

I also wanted to load a different css, based on that.

I proceeded as follows : if (!self::is_registered()) { $out->addStyle('/w/index.php?title=MediaWiki:NotLoggedIn.css&action=raw&ctype=text/css'); $out->addMeta( "logged", "no" ); } else{ $out->addStyle('/w/index.php?title=MediaWiki:LoggedIn.css&action=raw&ctype=text/css'); $out->addMeta( "logged", "yes" ); }

It works, but even though MediaWiki:NotLoggedIn.css is in my LocalSettings whitelist : $wgWhitelistRead=array(

       "MediaWiki:NotLoggedIn.css",//etc.

It can be displayed by users which are not authenticated. But '/w/index.php?title=MediaWiki:NotLoggedIn.css&action=raw&ctype=text/css' cannot.

Any idea of a workaround I could use ?

Thanks in advance for any suggestion anyone might have.

Tgr (WMF) (talkcontribs)

Use a normal file or ResourceLoader module rather than a wiki page, I suppose?

This kind of question is better suited for the Support desk, though.

Loizbec (talkcontribs)

I want the css to be editable by wiki users, so I want it to be a wiki page. I'll look at the ResourceLoader, and if I don't manage, I'll move it to the Support desk.

Thank you!

Reply to "Extension development"