In dokuwiki how can I hide "media manager" link or any other link on the top, from non logged in users?
8 Answers
one way is changing the template like this: 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
}
?>

- 2,083
- 4
- 29
- 44
-
Thanks! Perfect answer for StackOverflow. – Dan Rosenstark Mar 07 '15 at 16:18
-
This is actually hiding links for every logged-in users except admins. – phy25 Aug 24 '17 at 17:23
-
Does not work in Release 2018-04-22b "Greebo" because the tpl_action mechanism is deprecated and the php code changed (tested May 2019). – Ed Doerr May 25 '19 at 13:46
Not exactly what you're looking for (and maybe a bit late anyway), but here's a way to disable the Media Manager
link for all (including logged-in) users:
- go to admin panel, Configuration Settings;
- search for Disable DokuWiki actions (option name:
disableactions
); - in Other actions, add keyword
media
(see reference here).
Note that this will hide the link for everyone, but users with writing access can still launch the media manager by clicking on corresponding button when editing pages.

- 8,284
- 1
- 24
- 52
-
The fullscreen media manager is never accessible with this option. In my case, I could live with the popup, and chose this way because the top-rated answers from above do not work anymore (may 2019). – Ed Doerr May 25 '19 at 13:43
If no user is logged, $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)
));
}

- 21
- 1
My solution with "grebo"
- find inc/Action/Media.php
- edit method tplContent():
public function tplContent() {
global $INFO;
if ( empty($INFO['userinfo']) ) {
echo "<p>No way</p>";
return;
}
tpl_media();
}
So only users - but not anonymous - can see media manager.

- 21
- 1
Create a plugin. Let's assume 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 won't be overwritten by updates.
HINT: If you want to hind namespaces for users who are unable to read, try to set $conf['sneaky_index'] = 1
in the config file, though it may cause issues if deeper namespaces have higher permissions than the ones above.

- 101
- 4
I had this question myself recently and found the selected answer to be insufficient for me. I'm pretty sure it didn't work because I'm using the Codowik template rather than the default. This is what I came up with using sivann's 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>";
}
?>
It rather hackish, but I don't have time to dive deeper into how the template is implemented, and it works!

- 1,097
- 1
- 18
- 22
I wanted only the sitemap to be visible to visitors and registered users (I use the site as a blog), so only wanted recent changes and media links to be visible to me (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' );
}
}

- 1
My solution will may be hide too much information, but here we go:
- Login as admin
- Go the management section
- Scroll to ACL (Access Control List) Management
- Set User/Group „@all“ Permissions to „None“

- 4,617
- 9
- 48
- 61