forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: Magnus Lonnegren on May 01, 2005, 09:53:09 pm

Title: Customize top menu, admin vs user
Post by: Magnus Lonnegren 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
Title: Re: Customize top menu, admin vs user
Post by: Nibbler 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.
Title: Re: Customize top menu, admin vs user
Post by: Magnus Lonnegren 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
Title: Re: Customize top menu, admin vs user
Post by: Nibbler 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.
Title: Re: Customize top menu, admin vs user
Post by: Magnus Lonnegren 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
Title: Re: Customize top menu, admin vs user
Post by: donnoman 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');
    }
Title: Re: Customize top menu, admin vs user
Post by: Magnus Lonnegren 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
Title: Re: Customize top menu, admin vs user
Post by: nytemare 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.
Title: Re: Customize top menu, admin vs user
Post by: Keanuette 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....
Title: Re: Customize top menu, admin vs user
Post by: Keanuette on June 04, 2006, 04:53:51 pm
ok - scrub that - I'll start a new thread. sorry...