forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: skiahh on August 16, 2010, 05:25:47 pm

Title: Hardwired Theme autoscrolls down when logged in
Post by: skiahh on August 16, 2010, 05:25:47 pm
Hi folks -

My gallery is at www.teamnavycycling.org/photos and works fine when not logged in.  When you log in, however, it scrolls you down to the welcome message and below, hiding all the tools you logged in for unless you scroll up.  My new, non-tech users are asking where their controls are once they log in!

At the end of the login string in the title bar is "message_icon=info#cpgMessageBlock" which I think is the offending section.  Is there a way to have the page just stay at the top once logged in? 

Thank you.

Title: Re: Hardwired Theme autoscrolls down when logged in
Post by: Αndré on September 01, 2010, 04:42:25 pm
Just remove the anchor
Code: [Select]
<a name="cpgMessageBlock"></a>
Title: Re: Hardwired Theme autoscrolls down when logged in
Post by: skiahh on September 02, 2010, 04:34:19 am
Just remove the anchor
Code: [Select]
<a name="cpgMessageBlock"></a>

OK, thanks.  Can you tell me where to find that anchor, please?
Title: Re: Hardwired Theme autoscrolls down when logged in
Post by: Αndré on September 02, 2010, 08:36:48 am
Search in the theme.php file of your theme. If you don't find it there, copy this to your theme.php:
Code: [Select]
function theme_display_message_block() {
    global $lang_gallery_admin_menu, $lang_common, $CONFIG, $message_id;

    $superCage = Inspekt::makeSuperCage();
    $return = '';
    $message_id = '';
    $message_icon = '';
    $message_style = '';

    if ($superCage->get->keyExists('message_id')) {
      $message_id = $superCage->get->getEscaped('message_id');
    }

    if ($superCage->get->keyExists('message_icon')) {
        $message_icon = $superCage->get->getAlpha('message_icon');
    }

    if ($message_icon == 'error') {
        $message_style = 'cpg_message_error';
    } elseif ($message_icon == 'warning') {
        $message_style = 'cpg_message_warning';
    } elseif ($message_icon == 'validation') {
        $message_style = 'cpg_message_validation';
    } elseif ($message_icon == 'success') {
        $message_style = 'cpg_message_success';
    } else {
        $message_style = 'cpg_message_info';
    }

    if ($message_id != '') {
        $tempMessage = cpgFetchTempMessage($message_id);
        if ($tempMessage != '') {
            //$return .= '<a name="cpgMessageBlock"></a>';
            $return .= <<< EOT
            <div id="cpgMessage" class="cpg_user_message {$message_style}">
              {$tempMessage}
            </div>
EOT;
        }
    }
    if (GALLERY_ADMIN_MODE) {
        cpgCleanTempMessage(); // garbage collection: when the admin is logged in, old messages that failed to display for whatever reason are being removed to keep the temp_messages table clean
        $return .= cpg_alert_dev_version();
        // $return .= cpg_display_rss(); //add RSS feed from coppermine-gallery.net later
    } else { // not in admin mode
        //$return = '';
    }
    return $return;
}
Title: Re: Hardwired Theme autoscrolls down when logged in
Post by: skiahh on September 02, 2010, 05:07:40 pm
Awesome, thanks!