Customize top menu, admin vs user Customize top menu, admin vs user
 

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]

Main Menu

Customize top menu, admin vs user

Started by Magnus Lonnegren, May 01, 2005, 09:53:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Magnus Lonnegren

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:

<!-- 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

Nibbler

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

    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.

Magnus Lonnegren

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

Nibbler

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:

<!-- BEGIN search -->
...
<!-- END search -->


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

Magnus Lonnegren

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?

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


What I did then was this:

<!-- 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

donnoman

In $template_main_menu find:

<!-- 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:

<!-- 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.

   if (!GALLERY_ADMIN_MODE) {
       template_extract_block($template_main_menu, 'album_list');
   }

now needs to be

   if (!GALLERY_ADMIN_MODE) {
       template_extract_block($template_main_menu, 'album_list');
       template_extract_block($template_main_menu, 'search');
   }

Magnus Lonnegren

Quote from: donnoman on May 09, 2005, 01:14:34 AM
In $template_main_menu find:

<!-- 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:

<!-- 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.

    if (!GALLERY_ADMIN_MODE) {
        template_extract_block($template_main_menu, 'album_list');
    }

now needs to be

    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

nytemare

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.

Keanuette

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....

Keanuette

ok - scrub that - I'll start a new thread. sorry...