Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
hide website-tools from reading users
Avatar
heinrich #1
Member since May 2017 · 15 posts
Group memberships: Members
Show profile · Link to this post
Subject: hide website-tools from reading users
I would like to hide the website-tools section and its containing links from users that have only read permissions. Is that a template thing or a system setting? Thanks
Avatar
hj #2
Member since Apr 2008 · 167 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
Hi heinrich,

By website tools do you mean the symbols in the black column?...for edit, revisions, backlins etc?  Or do you mean the Site tools and User Tools at the bottom of the left blue column?

In either case there probably isn't anything you can do in the admin settings - you will most likely need to cut or change some of the code in the template's main.php file...specifcally regarding the sections <SITE TOOLS>,  <PAGE TOOLS>, <USER TOOLS>.

You may need some kind of IF-ELSE statement - i.e. 'if' logged in, show tools, 'else' don't show tools.  I'm not a coder so don't know how to write this, but someone else here might be able to help?

hj
Avatar
SFITCS #3
User title: Scott Ferguson
Member since Dec 2014 · 463 posts · Location: Canberra, Australia
Group memberships: Members
Show profile · Link to this post
In reply to post #1
It's a "hack".
This diff represents the changes necessary to lib/tpl/dokuwiki/main.php which prevents non-admin users from seeing the page tools:-
24c24
<     <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
---
>     <?php echo tpl_favicon(array('favicon', 'mobile', 'animated')) ?>
76a77
>                         if ($INFO['isadmin']) {
96a98,115
>                             } else {
>                                $data = array(
>                                'view'  => 'main',
>                                'items' => array(
>                                    'edit'      => tpl_action('edit',      1, 'li', 1, '<span>', '</span>'),
>                                    'subscribe' => tpl_action('subscribe', 1, 'li', 1, '<span>', '</span>'),
>                                    'top'       => tpl_action('top',       1, 'li', 1, '<span>', '</span>')
>                                 )
>                            );
>
>                             $evt = new Doku_Event('TEMPLATE_PAGETOOLS_DISPLAY', $data);
>                            if($evt->advise_before()){
>                            foreach($evt->data['items'] as $k => $html) echo $html;
>                             }
>                            $evt->advise_after();
>                            unset($data);
>                            unset($evt);
>                         }
Avatar
heinrich #4
Member since May 2017 · 15 posts
Group memberships: Members
Show profile · Link to this post
Thanks guys! Am I right by assuming that this "hack" will be lost on the next update?
Avatar
SFITCS #5
User title: Scott Ferguson
Member since Dec 2014 · 463 posts · Location: Canberra, Australia
Group memberships: Members
Show profile · Link to this post
Quote by heinrich:
Thanks guys! Am I right by assuming that this "hack" will be lost on the next update?

Yes - you are correct, though I've found it no problem to re-implement in the last couple of years.
Note also that there are two hacks in that example (I only just noticed) - the other hack allows the use of animated "favicons".

Logged in as Admin:-
[Image: https://scottferguson.com.au/uploads/files/logged_in.png]
Logged out:-
[Image: https://scottferguson.com.au/uploads/files/logged_out.png]
Avatar
turnermm (Moderator) #6
Member since Oct 2009 · 4627 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
I've been watching this thread, and have just written a small plugin that I've just installed on one of my own sites.  If you are using the dokuwiki template, it hides the page tools, which are displayed down the right side of the template, and it hides the recent changes and profile links at the top of the page.  As a plugin, it is independent of upgrades, unless of course the template itself is abandoned in favor of a new one.  With a little fiddling, it can be changed to suit your own needs.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
This post was edited on 2017-06-26, 03:28 by turnermm.
Avatar
SFITCS #7
User title: Scott Ferguson
Member since Dec 2014 · 463 posts · Location: Canberra, Australia
Group memberships: Members
Show profile · Link to this post
Thanks! What is this new plugin called? (a quick glance through the code you attached didn't show significant changes from the default wrap plugin).  I'll try and test it sometime over the next few days.

Any chance you could do the same for an "add animated favicons" plugin? The following diff applies changes that allow you to drop an animated icon into any of the same places a custom favicon can be added to DokuWiki, and your DokuWiki install will then sport an (annoying?) animated favicon in the browser.
/doku.php
105c105
<     ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|favicon\.ico|crossdomain\.xml)$/', $ID)) &&
---
>     ($conf['send404'] || preg_match('/^(robots\.txt|sitemap\.xml(\.gz)?|animated_favicon\.gif|favicon\.ico|crossdomain\.xml)$/', $ID)) &&
/inc/template.php
1910c1910
<  * Returns <link> tag for various icon types (favicon|mobile|generic)
---
>  * Returns <link> tag for various icon types (favicon|mobile|generic|animated)
1914c1914
<  * @param  array $types - list of icon types to display (favicon|mobile|generic)
---
>  * @param  array $types - list of icon types to display (favicon|mobile|generic|animated)
1934a1935,1938
>                 break;
>             case 'animated':
>                 $look = array(':wiki:animated_favicon.gif', ':animated_favicon.gif', 'images/animated_favicon.gif');
>                 $return .= '<link rel="icon" type="image/gif" href="'.tpl_getMediaFile($look).'" />'.NL;
/lib/tpl/scottferguson/detail.php
25c25
<     <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
---
>     <?php echo tpl_favicon(array('favicon', 'mobile', 'animated')) ?>
/lib/tpl/scottferguson/main.php
24c24
<     <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
---
>     <?php echo tpl_favicon(array('favicon', 'mobile', 'animated')) ?>
/lib/tpl/scottferguson/mediamanager.php
23c23
<     <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
---
>     <?php echo tpl_favicon(array('favicon', 'mobile', 'animated')) ?>
/lib/tpl/scottferguson/lang/en
diff /home/scott/Projects/scottferguson.com.au/DokuWiki/scottferguson/lib/tpl/scottferguson/lang/en/style.txt /var/www/scottferguson/lib/tpl/scottferguson/lang/en/style.txt
2,4c2,4
< will be automatically used. You can also upload a ''favicon.ico'' there. If you use a closed
< wiki it is recommended to make the ''wiki'' (or root) namespace world readable in the ACL settings or
< your logo is not shown to not logged in users.
---
> will be automatically used. You can also upload a ''favicon.ico'' or an ''animated_favicon.gif'' there.
> If you use a closed wiki it is recommended to make the ''wiki'' (or root) namespace world readable
>  in the ACL settings or your logo is not shown to not logged in users.
Avatar
turnermm (Moderator) #8
Member since Oct 2009 · 4627 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
That was a mistake!  Wrong file.  I'll post the correct one shortly.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
turnermm (Moderator) #9
Member since Oct 2009 · 4627 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Here's the correct file.  The plugin name and directory name is tmplft, for template fine-tune.

The wrap plugin is something I was working on to give users of ckgedit and ckgdoku a toolbar item that parallels the wrap plugin's picker tool.  If a user has installed the wrap plugin, this toolbar item automatically is inserted into the CKEditor toolbar.

As you see, tmplft is truly a 'small' plugin.  And it can be easily tailored to need.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
The author has attached one file to this post:
tmplft.zip 667 Bytes
You have no permission to open this file.
Avatar
turnermm (Moderator) #10
Member since Oct 2009 · 4627 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #1
I've  been working on a plugin, ever since this thread arose, which should solve your problem:
    https://www.dokuwiki.org/plugin:template-fine-tune
It does a variety of things for configuring the working side of the Dokuwiki template (i.e. not the Style side, for which there are many other plugins).  At the moment, it works only with the Dokuwiki template.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
heinrich #11
Member since May 2017 · 15 posts
Group memberships: Members
Show profile · Link to this post
Thank you for the plugin. I am using the writr template. Will your plugin be available for that template as well?
Avatar
turnermm (Moderator) #12
Member since Oct 2009 · 4627 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
I just updated tplmod for Greebo but it will not work in Writr--I just tested it.  Sorry.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
turnermm (Moderator) #13
Member since Oct 2009 · 4627 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #11
I just uploaded a test version that should enable you to control site and page tools in the Writr template, but not the other features of the plugin.
https://github.com/turnermm/tplmod/archive/test.zip
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
heinrich #14
Member since May 2017 · 15 posts
Group memberships: Members
Show profile · Link to this post
Thank you, great!
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-05-23, 06:11:13 (UTC +02:00)