Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
[MOD] Disable actions for guests (not logged-in users)
Avatar
guest #1
Member since Sep 2015 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: [MOD] Disable actions for guests (not logged-in users)
Hello

I use Dokuwiki 2014-09-29d "Hrun" and I needed to disable some actions for guests (not logged-in users). But Dokuwiki allows only to disable actions completely for all, so I made this simple hack. If somebody else need it, here it is. For instance, if you want to disable for guests Recent changes, Media Manager and Sitemap, in the file inc/confutils.php edit function actionOK():

Search:

==========
    return !in_array($action,$disabled);
}
==========

Replace to:

==========
  if(!empty($_SERVER['REMOTE_USER']))
    return !in_array($action,$disabled);

  if(in_array($action, Array('recent', 'media', 'index'))) //array of actions to disable
    return false;
    else
      return !in_array($action,$disabled);
}
==========

As a bonus to this hack is that links to disabled actions will be automatically hidden.

And what DW developers think about add this option to DW? This is simple: make new editbox on the Config page (under 'Disable DokuWiki actions'), this editbox will fill new config value $conf['disableactions4guests'], in the actionOK() function explode this string in array and compare. This is very simple. Do you think other users don't need it?

PS: List of DokuWiki actions is here, but it may be incomplete.

Bye
This post was edited on 2015-09-24, 22:06 by guest.
Avatar
andi (Administrator) #2
User title: splitbrain
Member since May 2006 · 3471 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This can be easily implemented in a plugin that modifies the conf['disableactions'] setting based on the current user.
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Avatar
Connz #3
Member for 2 weeks · 1 post
Group memberships: Members
Show profile · Link to this post
Sounds great and exactly what I am looking for, but sadly nobody seams to have implemented it yet!??

 Or is there now a better alternative to do this?
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-09-16, 22:37:08 (UTC +02:00)