Dokuwiki: how can I hide the link of the media manager from unregistered users?

In dokuwiki, how can I hide the "media manager" link or any other link above from unregistered users?

+6
source share
8 answers

one way modifies the template as follows: in / lib / tpl / dokuwiki / tpl _header.php:

<?php if ($INFO['isadmin']) { tpl_action('recent', 1, 'li'); //recent changes tpl_action('media', 1, 'li'); //media manager tpl_action('index', 1, 'li'); //sitemap } ?> 
+4
source

If no user is registered, $ INFO ["userinfo"] is empty

in / lib / tpl / dokuwiki / tpl_header.php replace

 tpl_toolsevent('sitetools', array( tpl_action('recent', true, 'li', true), tpl_action('media', true, 'li', true), tpl_action('index', true, 'li', true) )); 

with

  if(!empty($INFO["userinfo"])) { tpl_toolsevent('sitetools', array( tpl_action('recent', true, 'li', true), tpl_action('media', true, 'li', true), tpl_action('index', true, 'li', true) )); } 
+2
source

Create a plugin. Suppose the plugin name is nositetoolsanon , so you need to create a file under lib/plugins/nositetoolsanon/action.php .

 <?php if(!defined('DOKU_INC')) die(); class action_plugin_nositetoolsanon extends DokuWiki_Action_Plugin { public function getInfo(){ return array('date'=>'2017-08-25', 'name'=>'No sitetools for anonymous users', 'author'=>'Phy25'); } public function register(Doku_Event_Handler $controller) { $controller->register_hook('TEMPLATE_SITETOOLS_DISPLAY', 'BEFORE', $this, 'action_link'); } public function action_link(&$event, $param){ global $INFO; if(empty($INFO["userinfo"])){ // more robust check by ACL: global $ID; if (auth_quickaclcheck($ID) < AUTH_READ) $event->preventDefault(); } } } 

This method applies to any template and will not be overwritten by updates.

TIP. If you want to delay namespaces for users who cannot read, try setting $conf['sneaky_index'] = 1 in the configuration file, although this may cause deeper namespaces to have higher permissions than those listed above .

+1
source

Not quite what you are looking for (and maybe a little late), but here is a way to disable the Media Manager link for everyone (including registered users):

  • go to the admin panel, configuration settings;
  • search Disable DokuWiki actions (option name: disableactions );
  • In other actions, add the media keyword (see link here ).

Please note that this will hide the link for everyone, but users with write access can still start the media manager by clicking the corresponding button when editing pages.

0
source

I had this question recently, and I found the selected answer insufficient for me. I am sure this did not work because I am using the Codowik template, not the default. This is what I came up with using sivann answer.

I edited /lib/tpl/codowik/tpl_header.php and added this at the top:

 <?php if (!$INFO['isadmin']) { echo "<script> var newStyle = document.createElement('Style'); newStyle.innerHTML = '#codowiki_search_ul a {display: none;}'; document.head.appendChild(newStyle); </script>"; } ?> 

These are pretty hacks, but I don’t have time to delve deeper into how the template is implemented and it works!

0
source

I wanted only the site map to be visible to visitors and registered users (I use the site as a blog), so I wanted only the latest changes and links to the media to be visible to me (the administrator).

This is the code I changed in "Greebo", in inc / Menu / SiteMenu.php

  protected $types = array( //'Recent', // comment out stuff not required //'Media', 'Index' // leave sitemap for spiders ); // add this function // remove the "&& $INFO['isadmin']" to allow all logged in users to see options public function __construct(){ global $INPUT; global $INFO; if($INPUT->server->str('REMOTE_USER') && $INFO['isadmin']){ $this->types = array( 'Recent', 'Media', 'Index' ); } } 
0
source

My decision with the Grebo

  • find inc / action / media.php
  • TplContent () editing method:
 public function tplContent() { global $INFO; if ( empty($INFO['userinfo']) ) { echo "<p>No way</p>"; return; } tpl_media(); } 

Thus, only users can see the media manager - but not anonymous.

0
source

My solution may hide too much information, but here we go:

  • Login as admin
  • Go to the management section
  • Scroll to Access Control List (ACL)
  • Set user / group "@all" Permissions to "No"
-1
source

All Articles