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: disable menu for guests  (Read 3081 times)

0 Members and 1 Guest are viewing this topic.

buddy0815

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
disable menu for guests
« on: January 06, 2012, 10:18:36 pm »

Hi folks,

I whish to display all menu items just if the user is logged in. A guest does not need any menu items (because it's bridged to joomla and the joomla menu is enough)

I find out that this should be possible with the !USER_ID Flag. But where to place the if-command? in the theme.php?

Also it would be great if the hole div which contains the menu disappear when the user is not logged in so that there isn't an empty div on the page.

Can anyone help me with this?

Thanks in advance
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: disable menu for guests
« Reply #1 on: January 11, 2012, 12:41:16 pm »

Please try if the FinalExtract plugin fits your needs. If not, please post a link to your gallery and describe what exactly has to be removed (really the whole menu, including the login / register buttons?).
Logged

buddy0815

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: disable menu for guests
« Reply #2 on: January 11, 2012, 09:36:36 pm »

Thanks for your hint. Sounds great. Unfortunately I'm not able to install the plugin. It appears a button "install" but if I klick it, the page reloads and nothing else happens... Any Ideas? Would love to try that plugin.

And, to get back to your question. Yes, I'm trying to eliminate the whole menu when the user is not logged in. The cpg is bridged in a joomla page. Users have the joomla menu and can also log in via the joomla login field. After they are registered the cpg menu should appear.

Thanks and have a nice day
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: disable menu for guests
« Reply #3 on: January 11, 2012, 11:21:42 pm »

The final extract should work. Try putting your cpg install into standalone mode first. Joomla uses Mootools while CPG uses jQuery and sometimes they conflict which may be why you are having trouble installing the plugin.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: disable menu for guests
« Reply #4 on: January 12, 2012, 08:43:26 am »

Copy this to your theme's theme.php file:
Code: [Select]
/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    header("Content-Type: text/html; charset=$charset");
    user_save_profile();

    if (USER_ID) {
        $template_vars = array(
            '{LANG_DIR}' => $lang_text_dir,
            '{TITLE}' => theme_page_title($section),
            '{CHARSET}' => $charset,
            '{META}' => $meta,
            '{GAL_NAME}' => $CONFIG['gallery_name'],
            '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
            '{SYS_MENU}' => theme_main_menu('sys_menu'),
            '{SUB_MENU}' => theme_main_menu('sub_menu'),
            '{ADMIN_MENU}' => theme_admin_mode_menu(),
            '{CUSTOM_HEADER}' => $custom_header,
            '{JAVASCRIPT}' => theme_javascript_head(),
            '{MESSAGE_BLOCK}' => theme_display_message_block(),
        );
    } else {
        $template_vars = array(
            '{LANG_DIR}' => $lang_text_dir,
            '{TITLE}' => theme_page_title($section),
            '{CHARSET}' => $charset,
            '{META}' => $meta,
            '{GAL_NAME}' => $CONFIG['gallery_name'],
            '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
            '{SYS_MENU}' => '',
            '{SUB_MENU}' => '',
            '{ADMIN_MENU}' => theme_admin_mode_menu(),
            '{CUSTOM_HEADER}' => $custom_header,
            '{JAVASCRIPT}' => theme_javascript_head(),
            '{MESSAGE_BLOCK}' => theme_display_message_block(),
        );
    }
   
    $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
    echo template_eval($template_header, $template_vars);

    // Show various admin messages
    adminmessages();
}
/******************************************************************************
** Section <<<pageheader>>> - END
******************************************************************************/
Logged

buddy0815

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: disable menu for guests
« Reply #5 on: January 15, 2012, 02:38:08 pm »

@Phill, sorry even in the stand alone version, the installation of the plugin doesn't work. Clicking on the install button just let the page reload... nothing else seems to happen.

@André, thanks for the code. That works. Unfortunately the div in which the menu normally appears is still there. So there is a blank div if the user is not logged in.. So I get a step further but it's not solved anyway. Would be much better to make the whole div to disappear.

Nevertheless it will work for the first time.

Thanks to all
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 20 queries.