News:

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

AuthorTopic: Hiding items from SYS_MENU (Read 2135 times)

I've been trying to hide some items from {SYS_MENU} (my gallery, contact, upload file,... Basically leaving only home, register, login/logout), but I can't get it to work.I followed what was on this thread, copied all the files from sample/theme.php into my theme's theme.php, and so on. Then I commented out the items I don't need (I tried both /* ... */ and //). It seems to work fine when I'm logged it. The items I don't want there aren't showing, and all is well - until I log out. Then the gallery crashes and I get messages like,

Template error - Failed to find block 'my_gallery' (#<!-- BEGIN my_gallery -->(.*?)<!-- END my_gallery -->#s) in : (...). To get the gallery running again, I need to remove the comments from those items - which obviously cause them to show up again when the user is logged in - so what I was trying to accomplish to begin with is a complete fail.How can I remove those items from the gallery for the logged in user in a way it won't affect those that are logged out?Thanks.

/******************************************************************************** Section <<<assemble_template_buttons>>> - START******************************************************************************/// Creates buttons from a template using an array of tokens// this function is used in this file it needs to be declared before being called.function assemble_template_buttons($template_buttons,$buttons){$counter=0;$output='';

/******************************************************************************** Section <<<addbutton>>> - START******************************************************************************/// Creates an array of tokens to be used with function assemble_template_buttons// this function is used in this file it needs to be declared before being called.function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib=''){$menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib);}/******************************************************************************** Section <<<addbutton>>> - END******************************************************************************/

// {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{HREF_ATTRIBUTES}addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);// addbutton($sys_menu_buttons,'{CONTACT_LNK}','{CONTACT_TITLE}','{CONTACT_TGT}','contact',$template_sys_menu_spacer); // addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer); if (array_key_exists('allowed_albums', $USER_DATA) && is_array($USER_DATA['allowed_albums']) && count($USER_DATA['allowed_albums'])) {addbutton($sys_menu_buttons,'{UPL_APP_LNK}','{UPL_APP_TITLE}','{UPL_APP_TGT}','upload_approval',$template_sys_menu_spacer); }addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{SIDEBAR_LNK}','{SIDEBAR_TITLE}','{SIDEBAR_TGT}','sidebar',$template_sys_menu_spacer);// addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');// Login and Logout don't have a spacer as only one is shown, and either would be the last option.

/******************************************************************************** Section <<<assemble_template_buttons>>> - START******************************************************************************/// Creates buttons from a template using an array of tokens// this function is used in this file it needs to be declared before being called.function assemble_template_buttons($template_buttons,$buttons){$counter=0;$output='';

/******************************************************************************** Section <<<addbutton>>> - START******************************************************************************/// Creates an array of tokens to be used with function assemble_template_buttons// this function is used in this file it needs to be declared before being called.function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib=''){$menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib);}/******************************************************************************** Section <<<addbutton>>> - END******************************************************************************/

// {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{HREF_ATTRIBUTES}addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'','','','contact',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'','','','my_gallery',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer); if (array_key_exists('allowed_albums', $USER_DATA) && is_array($USER_DATA['allowed_albums']) && count($USER_DATA['allowed_albums'])) {addbutton($sys_menu_buttons,'{UPL_APP_LNK}','{UPL_APP_TITLE}','{UPL_APP_TGT}','upload_approval',$template_sys_menu_spacer); }addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{SIDEBAR_LNK}','{SIDEBAR_TITLE}','{SIDEBAR_TGT}','sidebar',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'','','','upload_pic',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');// Login and Logout don't have a spacer as only one is shown, and either would be the last option.

?>It would be better to set the permissions accordingly, as Coppermine will remove buttons automatically if the user has no permission to use it. I.e. deactivate the contact form and deny logged in users to create albums or upload pictures and those buttons won't appear.

Thank you, André! It did get my gallery up and running again. Just one question: where the contact link should be, there's now an extra empty space (an empty <a></a>). Any suggestion on how I could fix that?http://stanakaticbrasil.com/galteste

Thank you, André! It did get my gallery up and running again. Just one question: where the contact link should be, there's now an extra empty space (an empty <a></a>). Any suggestion on how I could fix that?http://stanakaticbrasil.com/galteste

Actually, this goes for the other "missing links" as well (my gallery, upload, etc) when logged in.

set the permissions accordingly, as Coppermine will remove buttons automatically if the user has no permission to use it. I.e. deactivate the contact form and deny logged in users to create albums or upload pictures and those buttons won't appear.