Topic on Project:Village Pump

Paul Hema (talkcontribs)

Moin moin.

Is it possible to control the elements in the Sidebar in dependence of the current usergroup? I think there is a new extension. But then you have to built a separate sidebar for every usergroup. I want only change ONE entry in the default sidebar.

Something like {{#ifgroup : thebestusergroupever | superartikle }}

thanks, Paul

By the way: is there a possibility to get a preview of my new theme?

Seb35 (talkcontribs)

@Paul Hema: I don’t know any such extension or way to do it in pure MediaWiki+PHP. Possibly you have to create an extension (the hard way) or write some JavaScript code. In JavaScript, you can do something like: (not tested, you have to debug it)

if( wgUserGroups.indexOf( 'autoconfirmed' ) == -1 ) {
    $( '#n-mainpage-description' ).style( 'display', 'none' );
}

This should hide the element “Main page” (identified by id="n-mainpage-description" in HTML) for users who are not in the group “autoconfirmed” (search $wgUserGroups in HTML to see the groups of the current user). Such code can be put in your MediaWiki:Common.js.

Preview of a theme (“skin” in MediaWiki language) is possible for each user: go in your preferences, tab Appearance and click “Preview” next to a skin. The available skins must be previously installed by the system administrator, and enabled in LocalSettings.php.

Seb35 (talkcontribs)

Ok, just tried. It almost worked but correct code is: (I confounded jQuery with D3.js I recently learned)

if( wgUserGroups.indexOf( 'autoconfirmed' ) == -1 ) {
    $( '#n-mainpage-description' ).css( 'display', 'none' );
}
Paul Hema (talkcontribs)
Legoktm (talkcontribs)
Paul Hema (talkcontribs)

Hi Legoktm,

it seems to work perfect for me (although the extension officially supports only MW version 1.24).

Thanks a lot.