Difference between revisions of "Talk:MediaWiki Tips"
Josef.Noll (Talk | contribs) (Created page with "= Dynamic Sidebar = . In includes/Skin.php there is a function called buildSidebar. Just edit that to check for $wgUser->isLoggedIn() and called a different system message tha...") |
Josef.Noll (Talk | contribs) |
||
Line 14: | Line 14: | ||
I got the same error with 1.12.0. But after adding global $wgUser it worked for me --62.245.235.214 14:24, 20 May 2008 (UTC) | I got the same error with 1.12.0. But after adding global $wgUser it worked for me --62.245.235.214 14:24, 20 May 2008 (UTC) | ||
Using the technique above...is there a way to get a different sidebar for different UserGroups. I tried using the technique i used in my Common.js where i: | Using the technique above...is there a way to get a different sidebar for different UserGroups. I tried using the technique i used in my Common.js where i: | ||
− | if('sysop' in $wgUserGroups) | + | if('sysop' in $wgUserGroups) |
− | ..do something | + | ..do something |
− | else | + | else |
− | ..do something else | + | ..do something else |
but that doesnt seem to be working. Also tried using $wgUser->getEffectiveGroups() but that evidently made a string of values and so i tried exploding it but not quite sure what the identifier should be (assumed '\n'). Any assistance would be grand | but that doesnt seem to be working. Also tried using $wgUser->getEffectiveGroups() but that evidently made a string of values and so i tried exploding it but not quite sure what the identifier should be (assumed '\n'). Any assistance would be grand | ||
+ | |||
+ | == variables== | ||
+ | ARTICLEPAGENAME, TALKPAGENAME |
Latest revision as of 12:27, 2 June 2014
Dynamic Sidebar
. In includes/Skin.php there is a function called buildSidebar. Just edit that to check for $wgUser->isLoggedIn() and called a different system message than Sidebar.
if ($wgUser->isLoggedIn()) { $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); } else { $lines = explode( "\n", wfMsgForContent( 'anon_sidebar' ) ); }
Then in your Wiki, go to MediaWiki:anon_sidebar and create your new sidebar. You can change the content of the sidebar with this code and restrict the modifications to anonymous users. --WIKImaniac 22:27, 1 March 2008 (UTC) This Mod sounds awesome, but on my wiki it does nothing... I added "global $wgUser;" , then deleted the line "$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );" and added the code in that position - no error, but the second sidebar is not seen (i created it as described in the manual) I´m using Mediawiki 1.11! Thanks for Help
Also broken in 1.12.0: "Fatal error: Call to a member function isLoggedIn() on a non-object in /home/intspeib/public_html/mediawiki-1.12.0/includes/Skin.php on line 1626" Singalen
I got the same error with 1.12.0. But after adding global $wgUser it worked for me --62.245.235.214 14:24, 20 May 2008 (UTC) Using the technique above...is there a way to get a different sidebar for different UserGroups. I tried using the technique i used in my Common.js where i:
if('sysop' in $wgUserGroups) ..do something else ..do something else
but that doesnt seem to be working. Also tried using $wgUser->getEffectiveGroups() but that evidently made a string of values and so i tried exploding it but not quite sure what the identifier should be (assumed '\n'). Any assistance would be grand
variables
ARTICLEPAGENAME, TALKPAGENAME