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]   Go Down

Author Topic: Customize top menu, admin vs user  (Read 9158 times)

0 Members and 2 Guests are viewing this topic.

Magnus Lonnegren

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Customize top menu, admin vs user
« on: May 01, 2005, 09:53:09 pm »

I have been searching the forum without result. I want the top menu (the 'Album list -  Login -
Last uploads ...'-menu) contain different links depending if you are logged in as admin or a regular anonymous visitor. For example I want to be able to use all the links as admin, but I do only want the visitor to be able to use the "last comments", "top rated" and "most viewed". How can I do this? I tried in the theme.php to delete for example:

Code: [Select]
<!-- BEGIN album_list -->
                        <a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a>
                        <img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />
<!-- END album_list -->

But when I did this it deleted the "Album list"-button, both as visitor and admin. Any suggestions how to solve this? Is it even possible?

//Magnus
« Last Edit: May 10, 2005, 02:31:57 am by donnoman »
Logged

Nibbler

  • Guest
Re: Customize top menu, admin vs user
« Reply #1 on: May 01, 2005, 10:11:28 pm »

It is possible, but not there, look further down to function theme_main_menu() and add a new block somewhere before the template_eval.

Code: [Select]
    if (!GALLERY_ADMIN_MODE) {
        template_extract_block($template_main_menu, 'album_list');
    }

Add new template_extract_block lines to remove all the elements from $template_main_menu that you want to hide from non admin users.
Logged

Magnus Lonnegren

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Customize top menu, admin vs user
« Reply #2 on: May 08, 2005, 06:41:55 pm »

Hello again =)

Yeah, this worked fine. But I did not managed to do it with the "Search"- and "My Favorites"-buttons. Where do I find where I can remove these? I can't see that they are used in the same way in theme.php?

//Magnus
Logged

Nibbler

  • Guest
Re: Customize top menu, admin vs user
« Reply #3 on: May 08, 2005, 09:38:44 pm »

Yes, there is no way coppermine would remove the search button under normal operation, so you have to tag it by wrapping the search part of $template_main_menu with:

Code: [Select]
<!-- BEGIN search -->
...
<!-- END search -->

and then it will respond. Same goes for favourites link.
Logged

Magnus Lonnegren

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Customize top menu, admin vs user
« Reply #4 on: May 08, 2005, 11:05:11 pm »

Hi again...

I tried to make the search-button to disappear with the help of the instructions above. But this was a bit to difficult for me, I think =)
First, the search-part you are talking about in $template_main_menu, is this it?

Code: [Select]
'{SEARCH_TGT}' => "search.php",
        '{SEARCH_LNK}' => $lang_main_menu['search_lnk'],

What I did then was this:

Code: [Select]
<!-- BEGIN search -->
<a href="{SEARCH_TGT}">{SEARCH_LNK}</a>
<!-- END search -->

Is this right at all? If it is, where should I put it in the theme.php? I need further instructions =(

Regards,
Magnus
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Customize top menu, admin vs user
« Reply #5 on: May 09, 2005, 01:14:34 am »

In $template_main_menu find:
Code: [Select]
<!-- END logout -->
                        <br />
                        <a href="{LASTUP_TGT}">{LASTUP_LNK}</a> ::
                        <a href="{LASTCOM_TGT}">{LASTCOM_LNK}</a> ::
                        <a href="{TOPN_TGT}">{TOPN_LNK}</a> ::
                        <a href="{TOPRATED_TGT}">{TOPRATED_LNK}</a> ::
                        <a href="{FAV_TGT}">{FAV_LNK}</a> ::
                        <a href="{SEARCH_TGT}">{SEARCH_LNK}</a>
                </span>

change to:
Code: [Select]
<!-- END logout -->
                        <br />
                        <a href="{LASTUP_TGT}">{LASTUP_LNK}</a> ::
                        <a href="{LASTCOM_TGT}">{LASTCOM_LNK}</a> ::
                        <a href="{TOPN_TGT}">{TOPN_LNK}</a> ::
                        <a href="{TOPRATED_TGT}">{TOPRATED_LNK}</a> ::
                        <a href="{FAV_TGT}">{FAV_LNK}</a> ::
<!-- BEGIN search -->
                        <a href="{SEARCH_TGT}">{SEARCH_LNK}</a>
<!-- END search -->
                </span>

The other block nibbler had you insert.
Code: [Select]
   if (!GALLERY_ADMIN_MODE) {
        template_extract_block($template_main_menu, 'album_list');
    }
now needs to be
Code: [Select]
   if (!GALLERY_ADMIN_MODE) {
        template_extract_block($template_main_menu, 'album_list');
        template_extract_block($template_main_menu, 'search');
    }
Logged

Magnus Lonnegren

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Customize top menu, admin vs user
« Reply #6 on: May 09, 2005, 11:58:22 pm »

In $template_main_menu find:
Code: [Select]
<!-- END logout -->
                        <br />
                        <a href="{LASTUP_TGT}">{LASTUP_LNK}</a> ::
                        <a href="{LASTCOM_TGT}">{LASTCOM_LNK}</a> ::
                        <a href="{TOPN_TGT}">{TOPN_LNK}</a> ::
                        <a href="{TOPRATED_TGT}">{TOPRATED_LNK}</a> ::
                        <a href="{FAV_TGT}">{FAV_LNK}</a> ::
                        <a href="{SEARCH_TGT}">{SEARCH_LNK}</a>
                </span>

change to:
Code: [Select]
<!-- END logout -->
                        <br />
                        <a href="{LASTUP_TGT}">{LASTUP_LNK}</a> ::
                        <a href="{LASTCOM_TGT}">{LASTCOM_LNK}</a> ::
                        <a href="{TOPN_TGT}">{TOPN_LNK}</a> ::
                        <a href="{TOPRATED_TGT}">{TOPRATED_LNK}</a> ::
                        <a href="{FAV_TGT}">{FAV_LNK}</a> ::
<!-- BEGIN search -->
                        <a href="{SEARCH_TGT}">{SEARCH_LNK}</a>
<!-- END search -->
                </span>

The other block nibbler had you insert.
Code: [Select]
    if (!GALLERY_ADMIN_MODE) {
        template_extract_block($template_main_menu, 'album_list');
    }
now needs to be
Code: [Select]
    if (!GALLERY_ADMIN_MODE) {
        template_extract_block($template_main_menu, 'album_list');
        template_extract_block($template_main_menu, 'search');
    }


This worked out just fine..! Thanks a lot..! =)

//Magnus
Logged

nytemare

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Customize top menu, admin vs user
« Reply #7 on: May 13, 2005, 07:51:56 pm »

How do i change other links so that it acts like the "Memberlist" link which only appears when a user is logged in and does not show to visitors who are not registered and logged in.
Logged

Keanuette

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Customize top menu, admin vs user
« Reply #8 on: June 04, 2006, 04:53:17 pm »

Hi

I found this thread and I want to do this with my gallery. How do you do it under the new version?

Thanks

And I wasn't sure whether I should have started a new thread or not....
Logged

Keanuette

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Customize top menu, admin vs user
« Reply #9 on: June 04, 2006, 04:53:51 pm »

ok - scrub that - I'll start a new thread. sorry...
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.