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
-
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
-
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.
-
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
-
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.
-
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
-
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');
}
-
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
-
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.
-
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....
-
ok - scrub that - I'll start a new thread. sorry...