I have two things I would like to accomplish. Could you help do this?
1) Change the URL of the login menu item.
2) Change the URL of the logout menu item.
What I have done so far:
-Searched the forums
-Examined the language file, template file, and theme.php file.
I'm pretty sure i might know where i need to make these changes, I'm just not sure as to what exact changes need to be made for this to work.
Ok, let me make more sense. I want to change the URL of the login/logout sys_menu items to differnet URLs. How do I do this?
you'll need to edit themes/yourtheme/theme.php
I can't figure out what code needs to go where.
Here is my theme.php code:
define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_HAS_NAVBAR_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);
$template_sys_menu_spacer='';
// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
<tr>
<td class="tableh1" width="40%"><b>{CATEGORY}</b></td>
<td class="tableh1" width="5%" align="center"><b>{ALBUMS}</b></td>
<td class="tableh1" width="5%" align="center"><b>{PICTURES}</b></td>
<td class="tableh1" width="40%"><b>{CATEGORY}</b></td>
<td class="tableh1" width="5%" align="center"><b>{ALBUMS}</b></td>
<td class="tableh1" width="5%" align="center"><b>{PICTURES}</b></td>
</tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
<tr>
<td class="tableh2" colspan="6"><table border="0"><tr><td>{CAT_THUMB} {DEBUG}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
</tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
<td class="tableb"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
<td class="tableb" align="center">{ALB_COUNT} {DEBUG}</td>
<td class="tableb" align="center">{PIC_COUNT}</td>
<!-- END catrow -->
<!-- BEGIN catrow_blank -->
<td class="tableb" align="center"></td>
<td class="tableb" align="center">{DEBUG}</td>
<td class="tableb" align="center"></td>
<!-- END catrow_blank -->
<!-- BEGIN footer -->
<tr>
<td colspan="6" class="tableh1" align="center"><span class="statlink"><b>{STATISTICS}</b></span></td>
</tr>
<!-- END footer -->
<!-- BEGIN spacer -->
<img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->
EOT;
function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
global $template_cat_list, $lang_cat_list;
starttable('100%');
if (count($cat_data) > 0) {
$template = template_extract_block($template_cat_list, 'header');
$params = array('{CATEGORY}' => $lang_cat_list['category'],
'{ALBUMS}' => $lang_cat_list['albums'],
'{PICTURES}' => $lang_cat_list['pictures'],
);
echo template_eval($template, $params);
}
$template_noabl = template_extract_block($template_cat_list, 'catrow_noalb');
$template = template_extract_block($template_cat_list, 'catrow');
$template_blank = template_extract_block($template_cat_list, 'catrow_blank');
$count=0;
$columnCount=2;
echo "<tr>";
foreach($cat_data as $category) {
$count++;
if (count($category) == 3) {
if ($count%$columnCount==0) {
$params = array('{DEBUG}' => "");
echo template_eval($template_blank, $params);
}
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{DEBUG}' => ""
);
$count=0;
echo template_eval($template_noabl, $params);
} else {
$params = array('{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{CAT_ALBUMS}' => $category['cat_albums'],
'{ALB_COUNT}' => $category[2],
'{PIC_COUNT}' => $category[3],
'{DEBUG}' => ""
);
echo template_eval($template, $params);
}
if ($count%$columnCount==0) {
echo "</tr> <tr>";
}
}
echo "</tr>";
if ($statistics && count($cat_data) > 0) {
$template = template_extract_block($template_cat_list, 'footer');
$params = array('{STATISTICS}' => $statistics);
echo template_eval($template, $params);
}
endtable();
if (count($cat_data) > 0)
echo template_extract_block($template_cat_list, 'spacer');
}
define('THEME_HAS_FILM_STRIP_GRAPHIC', 1);
function theme_slideshow()
{
global $CONFIG, $lang_display_image_php, $template_display_media;
pageheader($lang_display_image_php['slideshow']);
include "include/slideshow.inc.php";
$start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
template_extract_block($template_display_media, 'img_desc', $start_slideshow);
$params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
'{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
'{ADMIN_MENU}' => '',
);
starttable();
echo template_eval($template_display_media, $params);
endtable();
echo <<<EOT
<html>
<head>
<style type="text/css">
.style1 {
text-align: center;
}
</style>
</head>
<div class="style1">
<iframe name="I1" id="I1" src="http://mydpnet.com/photos/themes/fotogallery/musicsoundplayer.htm" style="height: 55px; width: 224px" scrolling="no" border="0" frameborder="0">
Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe></div>
</html>
EOT;
starttable(); echo <<<EOT
<tr>
<td align="center" class="navmenu" style="white-space: nowrap;">
<a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a>
</td>
</tr>
EOT;
endtable();
pagefooter();
}
?>
I saw some login/logout functions in the sample theme.php, but when i tried to add them to my theme.php, an error would always result.
Copy// Function for creating a main menu (SYS_MENU or SUB_MENU)
function theme_main_menu($which)
{
global $AUTHORIZED, $CONFIG, $album, $actual_cat, $cat, $REFERER;
global $lang_main_menu, $template_sys_menu, $template_sub_menu;
static $sys_menu = '', $sub_menu = '';
if ($$which != '') {
return $$which;
}
$album_l = isset($album) ? "?album=$album" : '';
$cat_l = (isset($actual_cat))? "?cat=$actual_cat" : (isset($cat) ? "?cat=$cat" : '');
$cat_l2 = isset($cat) ? "&cat=$cat" : '';
$my_gallery_id = FIRST_USER_CAT + USER_ID;
if ($which == 'sys_menu' ) {
if (USER_ID) {
template_extract_block($template_sys_menu, 'login');
} else {
template_extract_block($template_sys_menu, 'logout');
template_extract_block($template_sys_menu, 'my_profile');
}
if (!USER_IS_ADMIN) {
template_extract_block($template_sys_menu, 'enter_admin_mode');
template_extract_block($template_sys_menu, 'leave_admin_mode');
} else {
if (GALLERY_ADMIN_MODE) {
template_extract_block($template_sys_menu, 'enter_admin_mode');
} else {
template_extract_block($template_sys_menu, 'leave_admin_mode');
}
}
if (!USER_CAN_CREATE_ALBUMS) {
template_extract_block($template_sys_menu, 'my_gallery');
}
if (USER_CAN_CREATE_ALBUMS) {
template_extract_block($template_sys_menu, 'my_profile');
}
if (!USER_CAN_UPLOAD_PICTURES && !USER_CAN_CREATE_ALBUMS) {
template_extract_block($template_sys_menu, 'upload_pic');
}
if (USER_ID || !$CONFIG['allow_user_registration']) {
template_extract_block($template_sys_menu, 'register');
}
if (!USER_ID || !$CONFIG['allow_memberlist']) {
template_extract_block($template_sys_menu, 'allow_memberlist');
}
if (!$CONFIG['display_faq']) {
template_extract_block($template_sys_menu, 'faq');
}
$param = array(
'{HOME_TGT}' => $CONFIG['home_target'],
'{HOME_TITLE}' => $lang_main_menu['home_title'],
'{HOME_LNK}' => $lang_main_menu['home_lnk'],
'{MY_GAL_TGT}' => "index.php?cat=$my_gallery_id",
'{MY_GAL_TITLE}' => $lang_main_menu['my_gal_title'],
'{MY_GAL_LNK}' => $lang_main_menu['my_gal_lnk'],
'{MEMBERLIST_TGT}' => "usermgr.php",
'{MEMBERLIST_TITLE}' => $lang_main_menu['memberlist_title'],
'{MEMBERLIST_LNK}' => $lang_main_menu['memberlist_lnk'],
'{MY_PROF_TGT}' => "profile.php?op=edit_profile",
'{MY_PROF_TITLE}' => $lang_main_menu['my_prof_title'],
'{MY_PROF_LNK}' => $lang_main_menu['my_prof_lnk'],
'{ADM_MODE_TGT}' => "mode.php?admin_mode=1&referer=$REFERER",
'{ADM_MODE_TITLE}' => $lang_main_menu['adm_mode_title'],
'{ADM_MODE_LNK}' => $lang_main_menu['adm_mode_lnk'],
'{USR_MODE_TGT}' => "mode.php?admin_mode=0&referer=$REFERER",
'{USR_MODE_TITLE}' => $lang_main_menu['usr_mode_title'],
'{USR_MODE_LNK}' => $lang_main_menu['usr_mode_lnk'],
'{UPL_PIC_TGT}' => "upload.php",
'{UPL_PIC_TITLE}' => $lang_main_menu['upload_pic_title'],
'{UPL_PIC_LNK}' => $lang_main_menu['upload_pic_lnk'],
'{REGISTER_TGT}' => "register.php",
'{REGISTER_TITLE}' => $lang_main_menu['register_title'],
'{REGISTER_LNK}' => $lang_main_menu['register_lnk'],
'{LOGIN_TGT}' => "login.php?referer=$REFERER",
'{LOGIN_TITLE}' => $lang_main_menu['login_title'],
'{LOGIN_LNK}' => $lang_main_menu['login_lnk'],
'{LOGOUT_TGT}' => "logout.php?referer=$REFERER",
'{LOGOUT_TITLE}' => $lang_main_menu['logout_title'],
'{LOGOUT_LNK}' => $lang_main_menu['logout_lnk'] . " [" . stripslashes(USER_NAME) . "]",
'{FAQ_TGT}' => "faq.php",
'{FAQ_TITLE}' => $lang_main_menu['faq_title'],
'{FAQ_LNK}' => $lang_main_menu['faq_lnk'],
);
$sys_menu = template_eval($template_sys_menu, $param);
} else {
if (!$CONFIG['custom_lnk_url']) {
template_extract_block($template_sub_menu, 'custom_link');
}
$param = array(
'{ALB_LIST_TGT}' => "index.php$cat_l",
'{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
'{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
'{CUSTOM_LNK_TGT}' => $CONFIG['custom_lnk_url'],
'{CUSTOM_LNK_TITLE}' => $CONFIG['custom_lnk_name'],
'{CUSTOM_LNK_LNK}' => $CONFIG['custom_lnk_name'],
'{LASTUP_TGT}' => "thumbnails.php?album=lastup$cat_l2",
'{LASTUP_TITLE}' => $lang_main_menu['lastup_title'],
'{LASTUP_LNK}' => $lang_main_menu['lastup_lnk'],
'{LASTCOM_TGT}' => "thumbnails.php?album=lastcom$cat_l2",
'{LASTCOM_TITLE}' => $lang_main_menu['lastcom_title'],
'{LASTCOM_LNK}' => $lang_main_menu['lastcom_lnk'],
'{TOPN_TGT}' => "thumbnails.php?album=topn$cat_l2",
'{TOPN_TITLE}' => $lang_main_menu['topn_title'],
'{TOPN_LNK}' => $lang_main_menu['topn_lnk'],
'{TOPRATED_TGT}' => "thumbnails.php?album=toprated$cat_l2",
'{TOPRATED_TITLE}' => $lang_main_menu['toprated_title'],
'{TOPRATED_LNK}' => $lang_main_menu['toprated_lnk'],
'{FAV_TGT}' => "thumbnails.php?album=favpics",
'{FAV_TITLE}' => $lang_main_menu['fav_title'],
'{FAV_LNK}' => $lang_main_menu['fav_lnk'],
'{SEARCH_TGT}' => "search.php",
'{SEARCH_TITLE}' => $lang_main_menu['search_title'],
'{SEARCH_LNK}' => $lang_main_menu['search_lnk'],
);
$sub_menu = template_eval($template_sub_menu, $param);
}
return $$which;
}
from themes/sample/theme.php into a new line before?>
of themes/yourtheme/theme.php
Then edit the code you just added, find'{LOGIN_TGT}' => "login.php?referer=$REFERER",
and'{LOGOUT_TGT}' => "logout.php?referer=$REFERER",
and edit as you see fit. If this causes an error, post your changes.
Perfect. Just in case you were wondering why I wanted the login/logout ones specifically, I was integrating a CMS with coppermine.
You should then rather come up with a bridge file - this takes care of logging in and out as well.