Advanced search  

News:

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.
[more]

Pages: 1 [2]   Go Down

Author Topic: How do I remove a button from the menu?  (Read 69385 times)

0 Members and 1 Guest are viewing this topic.

Linea

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: How do I remove the Login button from the menu?
« Reply #20 on: January 03, 2006, 12:53:14 am »

It works 50%. I can comment out some features from the SUB_MENU, e.g. "toprated" or "last commented". But I fail when I want to comment out the feature "my gallery" in the SYS_MENU. OK, ist's only a flaw, but I want to understand the system...

At the moment my theme.php looks like this:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.1
  $Source:
  $Revision: 1.10 $
  $Author:
  $Date: 2005/04/30 07:13:16 $
**********************************************/

define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1); // Remove this if you edit this template until
                                           // you have validated it. See docs/theme.htm.


// 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='';

    foreach ($buttons as $button)  {
      if (isset($button[4])) {
         $spacer=$button[4];
      } else {
      $spacer='';
      }

        $params = array(
            '{SPACER}'     => $spacer,
            '{BLOCK_ID}'   => $button[3],
            '{HREF_TGT}'   => $button[2],
            '{HREF_TITLE}' => $button[1],
            '{HREF_LNK}'   => $button[0]
            );
        $output.=template_eval($template_buttons, $params);
    }
    return $output;
}


// 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) {
  $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer);
}


// HTML template for sys_menu
$template_sys_menu = <<<EOT
          {BUTTONS}
EOT;

// HTML template for sub_menu
$template_sub_menu = $template_sys_menu;

if (!defined('THEME_HAS_NO_SYS_MENU_BUTTONS')) {

  // HTML template for template sys_menu spacer
  $template_sys_menu_spacer ="***";

  // HTML template for template sys_menu buttons
  $template_sys_menu_button = <<<EOT
  <!-- BEGIN {BLOCK_ID} -->
        <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a> {SPACER}
  <!-- END {BLOCK_ID} -->
EOT;

  // HTML template for template sys_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$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);
    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,'{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,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$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.

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
  $template_sys_menu = template_eval($template_sys_menu,$params);
}

if (!defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {

  // HTML template for template sub_menu spacer
  $template_sub_menu_spacer = $template_sys_menu_spacer;

  // HTML template for template sub_menu buttons
  $template_sub_menu_button= $template_sys_menu_button;

  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}


?>
« Last Edit: January 04, 2006, 12:43:35 pm by GauGau »
Logged

Linea

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: How do I remove the Login button from the menu?
« Reply #21 on: January 03, 2006, 02:11:08 am »

I give it up. No chance to remove any of the links in the SYS_MENU. I tried the solution with the plugin, but I completely failed. ???

Quote
Upload and enable the final_extract plugin.

I extracted the zip file and upoaded it in the plugins folder. But what exactly do I have to do to ENABLE it??  I can't see any difference between the time before and after the upload.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: How do I remove the Login button from the menu?
« Reply #22 on: January 03, 2006, 07:45:22 am »

when you need help on a plugin, reply to the thread that deals with it.
Logged

Linea

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: How do I remove the Login button from the menu?
« Reply #23 on: January 03, 2006, 12:49:16 pm »

Didn't I do that? ;-)


Quote
Re: How do I remove the Login button from the menu?
« Reply #10 on: December 22, 2005, 08:59:14 PM »   

--------------------------------------------------------------------------------

re-enable the items in sys_menu so we don't get template errors; we will strip the login and home links with a plugin

I don't mind whether we solve my problem with or without a plugin. I am not interested in HOW to do it, I am interested in THAT we do it. I would be very glad to find a quite simple solution for that!
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: How do I remove the Login button from the menu?
« Reply #24 on: January 04, 2006, 04:34:09 am »

once you dump the plugin into the plugins directory you need to actually turn it on.

Open up your config, one of the uptions is "plugin manager" on the right side.

Find the plugin you want to turn on in the plugin manager and click the "I" for install.

That should do it.
Logged

Linea

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: How do I remove the Login button from the menu?
« Reply #25 on: January 04, 2006, 11:08:09 am »

It works! It really works!! Jippieh!!! Wow, that was not an easy thing to do, but finally we got it!  :D

Thank you very very much for your help, donnoman! 
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1608
  • Paul Van Rompay
Re: How do I remove a button from the menu?
« Reply #26 on: January 24, 2006, 05:51:50 pm »

Here's a thread for the final_extract plugin:
http://forum.coppermine-gallery.net/index.php?topic=26893.0.

Please ask questions that only deal with the plugin on that thread.
Logged

biker-boy

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: How do I remove a button from the menu?
« Reply #27 on: March 03, 2006, 06:36:13 pm »

OK FIXED IT ... Sorry I didn't install the plug in.   HA HA .. only wasted 4 days on this  lol

Removing top menu buttons doens't work for me.
I've read this whole thread about 5 times. I've downloaded and installed the lasted version of CPG.
I've now use the sample theme file in my new bikernight theme, just so I don't miss anything out.
I've also enabled plugins and uploaded the file you suggest adding in to it :

function final_extract_page_html($html)
{   
    //repeat the next line for each block you would like removed
    final_extract_block($html, 'home');
        final_extract_block($html, 'my_gallery');
   final_extract_block($html, 'allow_memberlist');
   final_extract_block($html, 'my_profile');
   final_extract_block($html, 'enter_admin_mode');
   final_extract_block($html, 'leave_admin_mode');
   final_extract_block($html, 'register');
   final_extract_block($html, 'album_list');
   final_extract_block($html, 'lastup');
   final_extract_block($html, 'lastcom');
   final_extract_block($html, 'topn');
   final_extract_block($html, 'toprated');
   final_extract_block($html, 'favpics');
   final_extract_block($html, 'search');

      return $html;
}

but NO matter what I do .. I can't remove the  "My Favorites" or "Search link" at the top of each page.
What can it be!  I'm at about to lose the only bit of hair I've left. lol
Please help
ta Matt
« Last Edit: March 03, 2006, 06:41:51 pm by biker-boy »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1608
  • Paul Van Rompay
Re: How do I remove a button from the menu?
« Reply #28 on: March 03, 2006, 07:15:53 pm »

A link to your site would be useful.  My guess is that your "My Favorites" and "Search" links are not marked correctly with the block tags 'favpics' and 'search' respectively.  The Coppermine default themes should have these links marked correctly. 

So take a look at your theme.php to see how those 2 links are rendered.  You can paste those lines here if you need assistance.  Final_extract only works when the block is marked by the <!-- BEGIN block --> and <!-- END block --> tags.
Logged

nontekkyguy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 59
Re: How do I remove a button from the menu?
« Reply #29 on: March 05, 2006, 11:03:13 am »

I'm using "fruity" theme and I don't want the "MyFavorites" button to appear. I've tried to use the final_extract plugin but that doesn't work. I've also tried to understand the responses above, but I can't seem to find the files mentioned. I've checked my directories for the theme.php file within the themes folder for Fruity. I did however, find theme.inc.php.  Can anyone offer some advice?

This is what I find in theme.php within the fruity theme folder:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
  $Source: /cvsroot/coppermine/stable/themes/fruity/theme.php,v $
  $Revision: 1.16 $
  $Author: gaugau $
  $Date: 2006/02/24 13:32:45 $
**********************************************/

// ------------------------------------------------------------------------- //
// The theme "Fruity" has been done by GauGau (http://gaugau.de/) based on   //
// the framed template of studicasa.nl (their website has gone down, so I    //
// guess no one will care). The usage of this theme is free for personal     //
// use, not for commercial use (according to the disclaimer of studiocasa)!  //
// ------------------------------------------------------------------------- //

define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_HAS_NAVBAR_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);  // Remove this if you edit this template until
                                            // you have validated it. See docs/theme.htm.

// HTML template for main menu
$template_sys_menu = <<<EOT
                <div class="topmenu">
                     {BUTTONS}
                </div>
EOT;

// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='';


?>
Logged
learning requires patience; teaching requires more

Fudgemaster

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 45
    • Trackdays, Car shows, Nature and some misc photos
Re: How do I remove a button from the menu?
« Reply #30 on: March 05, 2006, 01:44:57 pm »

I'm using "fruity" theme and I don't want the "MyFavorites" button to appear. I've tried to use the final_extract plugin but that doesn't work. I've also tried to understand the responses above, but I can't seem to find the files mentioned. I've checked my directories for the theme.php file within the themes folder for Fruity. I did however, find theme.inc.php.  Can anyone offer some advice?

I've edited the themes.inc.php and commented the unnecessary buttons out byt adding // to the start of the line.

Code: [Select]
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'Stats','Statistics','http://www.partanen.net/gallery/stats.php','stats',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'Calendar','Events calendar','http://www.partanen.net/calendar/','calendar',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'RSS','RSS feed of updates','http://www.partanen.net/news.xml','RSS',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');
    } //{THEMES}

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}

Editing this file was if I remember, not suggested, but still this is how I pulled it off.
Logged
--
It's an insane world.. But I'm proud to be a part of it.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: How do I remove a button from the menu?
« Reply #31 on: March 05, 2006, 01:51:02 pm »

you mustn't edit include/themes.inc.php, under no circumstances. Undo your changes there. Instead, edit themes/yourtheme/theme.php in a similar manner.
Logged

manne

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 27
Re: How do I remove a button from the menu?
« Reply #32 on: March 16, 2006, 08:19:38 pm »

I get this error message:
Quote
Template error
Failed to find block 'custom_link'(#(<!-- BEGIN custom_link -->)(.*?)(<!-- END custom_link -->)#s) in :

When I have added these lines in my theme.php (im trying to remove the favorite link)
Code: [Select]
// manne
// 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='';

    foreach ($buttons as $button)  {
      if (isset($button[4])) {
         $spacer=$button[4];
      } else {
      $spacer='';
      }

        $params = array(
            '{SPACER}'     => $spacer,
            '{BLOCK_ID}'   => $button[3],
            '{HREF_TGT}'   => $button[2],
            '{HREF_TITLE}' => $button[1],
            '{HREF_LNK}'   => $button[0]
            );
        $output.=template_eval($template_buttons, $params);
    }
    return $output;
}

// manne
// 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) {
  $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer);
}

// manne
if (!defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {

  // HTML template for template sub_menu spacer
  $template_sub_menu_spacer = $template_sys_menu_spacer;

  // HTML template for template sub_menu buttons
  $template_sub_menu_button= $template_sys_menu_button;

  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}


have I missed something?
Logged
/manne

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: How do I remove a button from the menu?
« Reply #33 on: March 16, 2006, 11:49:24 pm »

karma taken, thread locked. *sigh*
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.033 seconds with 20 queries.