Advanced search  


cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Menu only visible for admin  (Read 3343 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 3
Menu only visible for admin
« on: December 15, 2005, 03:16:50 pm »


Id like to make themenu only visible to the admin user - I searched the forum and found this:
But somehow this is not working - Im using 1.4.2 and the solution was for 1.3.x -

I changed the line in to         '{SUB_MENU}' => USER_IS_ADMIN ? theme_main_menu() : '',
but it didnt work...

any ideas?


  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From
    • Donovan Bray
Re: Menu only visible for admin
« Reply #1 on: December 18, 2005, 03:02:37 am »

I see two problems with your modifcation.

#1  theme_main_menu()  needs to know which menu you actually want returned ie: theme_main_menu('sub_menu')
#2 Your editing which is a No-No. (Why? because your mod will break any theme that uses the sub_menu to unhide the sys_menu like mac_ox_x)

Any time developers are tempted to look at editing you should look at using a plugin instead.

In this particular case if you intend on making this work for themes like mac_ox_x it really is a requirement.

heres the suggested codebase:
Code: [Select]
// Add a filter

function nosubmenu($html)
    if (!USER_IS_ADMIN) {
        if (strstr($html,'MM_showHideLayers')) {
            if (strstr($html,'id="SUB_MENU"')) {
               $html=str_replace('{SYS_MENU}',"{SYS_MENU}<script type=\"text/JavaScript\">MM_showHideLayers('SYS_MENU','','show')</script>",$html);
            } elseif (strstr($html,'id="Menu1"')) {
               $html=str_replace('{SYS_MENU}',"{SYS_MENU}<script type=\"text/JavaScript\">MM_showHideLayers('Menu1','','show')</script>",$html);
            $html=str_replace('{SUB_MENU}','<div style="visibility:hidden">{SUB_MENU}</div>',$html);
        } else {
    return $html;

plugin attached.
Pages: [1]   Go Up

Page created in 0.018 seconds with 19 queries.