From MediaWiki.org
Jump to navigation Jump to search
Bluespice icon
UserSidebar was developed for BlueSpice. Learn more about it at the bottom of this page.

MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: stable
BlueSpice v2017.png
Description Adds an individual user navigation ("Focus" tab) to the sidebar
Author(s) Hallo Welt! GmbH
Maintainer(s) Hallo Welt! GmbH
Latest version 3.1 (2019/09/19)
Compatibility policy LTS release branches
MediaWiki 1.31 (LTS)
License GNU General Public License 3.0 only
Download See BlueSpice on SourceForge
Example en.demo.bluespice.com
Translate the UserSidebar extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug


The UserSideBar, also known as the Focus, lets a user generate an own personal navigation menu. The user can place the functions and articles which he uses most there. It is only visible for this user.


Usage / Features[edit]

* My favourite pages (title) 
** [[Page chosen|Name of the link e.g. BlueSpice]]
** [[Page chosen|Another link e.g. Hallo Welt!]]

Read more about the usage of UserSidebar in the helpdesk.

Developer Info[edit]

To add / register a custom Widget, the following steps have to be done.

  • Add the following two hooks in extension.json (replace MyExtension with your class name):
"BSUserSidebarDefaultWidgets": "MyExtension::onBSUserSidebarDefaultWidgets",
"BSWidgetListHelperInitKeyWords": "MyExtension::onBSWidgetListHelperInitKeyWords"
  • Define callback functions in "MyExtension"
 public static function onBSWidgetListHelperInitKeyWords( &$aKeywords, $oTitle ) {
  $aKeywords['MYKEYWORD'] = 'MyExtension::onWidgetListKeyword';
  return true;
 public static function onBSUserSidebarDefaultWidgets( &$aViews, $oUser, $oTitle ) {
  $aViews['MYKEYWORD'] = self::getViewWidget();
  return true;

 public static function onWidgetListKeyword() {
  return self::getViewWidget();
  • Define view creator
 public static function getViewWidget(){
  $context = new RequestContext();
  $oUser = $context->getUser();
  if($oUser->getId() == 0){

  $dbr = wfGetDB( DB_SLAVE );
  $res = $dbr->select(
   [ 'my_table' ], //table
   [ 'my_table_page_name', 'my_table_page_namespace', 'my_table_page_owner' ],//selected field
   [ 'my_table_page_owner' => $oUser->getName() ],//filter
   [ 'LIMIT' => 10, 'ORDER BY' => 'my_table_page_name' ]//options
  $aData = array();
  foreach ( $res as $row ) {
   $oTitle = Title::makeTitle( $row->my_table_page_namespace, $row->my_table_page_name );
   $sLink = Html::element(
    'a', [
    'href' => $oTitle->getLinkURL(),
    'title' => $oTitle->getText()
    ], $oTitle->getText()
   $aData[] = "<li>" . $sLink . "</li>";

  $oViewWidget= new ViewWidget();
   ->setAdditionalBodyClasses( array( 'bs-nav-links' ) )
   ->setTitle( wfMessage( 'myextension-widget-title' )->plain() )
   ->setBody( "<ul>".implode("\n", $aData)."</ul>" )
  return $oViewWidget;
  • define i18n key for the label "myextension-widget-title"
  • the widget should be visible for logged in users in UserSidebar now

Bluespice icon
This extension was originally made for BlueSpice. BlueSpice is a MediaWiki distribution for enterprises and organizations.
It enhances MediaWiki, in particular in the areas of quality management, process support, administration, editing and security.

You can download this extension with BlueSpice free.

BlueSpice: Portal - Website - Demo - Helpdesk - BlueSpice free download - Setup Portal - Blog - Twitter