Hutchy68 / pivot

A MediaWiki mobile skin which "Pivots" seamlessly to any size display.
https://pivot.wikiproject.net
BSD 2-Clause "Simplified" License
37 stars 18 forks source link

Hide Sidebar when users not logged in, using $wgHooks #79

Closed PhrygianPhrog closed 4 years ago

PhrygianPhrog commented 5 years ago

I would like to hide the Pivot sidebar when users are not logged in, using a hook, but I don't understand how Pivot's $bar array is structured. What do I add to the following function in localSettings.php?

function lfHideSidebar( $skin, &$bar ) {
 global $wgUser;
  if ( !$wgUser->isLoggedIn() ) {
    $bar = array(
        // What do I put here?
      )
    );
  } else {
    // Display the sidebar as usual.
  }
  return true;
}

Thank you

Hutchy68 commented 5 years ago

You have to build an array of values based on what you want to show for a non logged in user. Based on you code // What do I put here?

Your array is text, href, and id. active is optional. href can be optional. Just leave it unset.

This page https://mediawiki.org/wiki/Manual:Interface/Sidebar/Hacks gives a good example on how to create your own anonymous sidebar for unlogged in users. This way you can build a anonymous sidebar with wiki mark up and display it when a anonymous user views the site.

If you’re looking to hide the sidebar completely and not display it, Pivot doesn’t do that.

PhrygianPhrog commented 5 years ago

Thanks for your help.

In the end I got round it by making an empty sidebar for anonymous users, then hiding the remnants of it with some CSS injected via localSettings.php

Hutchy68 commented 4 years ago

No Activity