Hide Administrator options
otografias
Joined: 2011-10-20
Posts: 41 |
Posted: Wed, 2013-10-30 17:28 |
Hello everybody! At the time: 1) Duplicate theme, and in a new theme, in "screen.CSS" file of my new theme folder copy this code that i find in forums #g-site-menu li:nth-child(4) { 2) Duplicate admin theme too, and hide all menu, removing <?= $theme->admin_menu() ?> from admin.html.php 3) Hide home link and 4) Use Custom menus to make a new administrator menu linked to all ok but have two bugs (known at this time). At the moment I´m tried to add the same of "custom menus" links to a "pages settings" module. a new page only visible by admin. its posible? thanks to all |
|
Posts: 1857
I think you can wrap the admin part in an if statement that shows only if
$user->admin
oris_admin
is true.I'm not 100% sure, but try
if($user->admin){ ADMIN MENU HERE; }
EDIT: As a side note, couldn't you just add them as a user with all of the permissions they'll need? You'd be the only true admin, but they could do whatever else needs to be done on the site.
Posts: 41
Not sure about how to do it.
adding code to module "custom menu" will hide menu to no admin users?
sorry for dumbs questions but I'm just a photographer, and is a little hard for me to work with programming... :-S
I don´t know the way to make a user permission to admins users....
I would like to build the site, assign one admin, to administrate content, users and comments, and forget the site in assured that I will not give me problems.
thanks
.
Posts: 1857
I don't know the details of how you made the custom menu.
Go to whatever file you made the menu in. Then go to the line where the code for the menu starts and add this line BEFORE the menu code:
if($user->admin){
. Then go to the end of the code for the custom menu and add this line AFTER the code:}
See if it works.
You still need to make periodic backups of the site contents/code and database.
Posts: 41
I give up! :-P
i made my own administrator menu with a module "Custom Menus", i tried to insert your code in in several different sites of "admin_custom_menus.html.php" file in "Controllers" folder, but it´s too extensive and complicate language to me.... (I am very happy to keep things running yet... after so many changes... xD
If somebody would find the site where the code print the menu on page... i would be so grateful!
Posts: 1857
Restore that file back to its original state.
Open the views file.
Try adding
<? if($user->admin){ ?>
between the first and second lines.Then add
<? } ?>
to the end of the file.Posts: 41
Ups... nothing change
in folder
/modules/Custom_menus/view/admin_custom_menus.html.php
I would be modify to this way:
i think its ok... but nothing change
you can see in
bodas.otografias.com
thanks for your time
Posts: 27300
Why? Why not just use the regular menu for access these functions then they show properly checking permissions along the way.
Your going to have to edit the module to remove them. Then I suspect in the future your going to add items to the menu that the guest or others will have access to and then your going to wonder why they don;t show up for them.
The custom menu module was not really designed for adding shortcuts to the menu for admin functions. Perhaps bookmarks in your browser is a better way to go?
one could hide the li with jquery :
$( ".target" ).hide();
where .target this the jquery selector you want to hide.
lots of jquery tutorials on selectors on the web.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 41
I tried with all my might, but i´m afraid jquery its to mess to me. don´t understand anything, its more easy to me try to do in a classical html.
think its possible?
Posts: 41
I´m very delighted. you used Jquery to delete options?
Posts: 41
Im Very Near to get it!
last news,
I Resume :
1) I change the theme to clean-canvas.
2) Delete admin menu in same way:
3) In Module Pages create a Page called "Administrator_Menu" and hide in top menu bar (put only in sidebar)
4) In the page paste links only to admin users and moderate comments
Problems:
when go to the created "Administrator menu" Page, in the "top menu" returns admin options!!... of course. i Hide only "nth-child(4)", and menu its now child(1) Ups!
i find the code to hide this menu definitely, using "Safari Develop menu" but... I can´t find in themes files.
Here you can see a graphical explain of the problem and a possible solution
thanks!
Posts: 41
thanks Temp!!!
i make my own admin menu with "Pages" module, adding link in sidebar, and it´s only visible for admins because insert your code in module Pages/views/pages_sidebar.html.php
all ok!!
only need the way to permanently hide the admin menu for all users
in the next Post may be...
thanks to all