Need solution: Undefined index: customer_id when using sidebox/login_box.php
Hi,
Any help would be appreciated.
I use the plugin Login Box, but I'm receiving debug errors in 157 (mostly like earlier too but didn't notice until I turned debugging on.
Can anyone help me to fix the undefined index below? The plugin hasn't been updated since 138a.
[30-Nov-2020 15:49:01 America/New_York] PHP Notice: Undefined index: customer_id in /Users/..../login_box.php on line 37
[30-Nov-2020 15:49:01 America/New_York] PHP Notice: Undefined index: customer_id in /Users/..../tpl_login_box.php on line 33
$content = "<!-- loginSideBox -->" . "\n\n";
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
if(!$_SESSION['customer_id']) {
$content .=zen_draw_form('login_box', zen_href_link(FILENAME_LOGIN, 'action=process', 'SSL'), 'post', 'id="loginFormSidebox"');
$content .=LOGIN_BOX_EMAIL_ADDRESS . '<br />' . zen_draw_input_field('email_address', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"').'<br />';
$content .=LOGIN_BOX_PASSWORD . '<br />' . zen_draw_password_field('password', '', 'size="18" maxlength="100" style="width: ' . ($column_width-30) . 'px"') . '<br />';
$content .='<a href="' . zen_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . LOGIN_BOX_PASSWORD_FORGOTTEN . '</a>' . '<br />' . '<a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . LOGIN_BOX_CREATE_ACCOUNT . '</a>' . '<br />';
$content .= zen_draw_hidden_field('securityToken', $_SESSION['securityToken']);
$content .='<div class="centeredContent">'.zen_image_submit(BUTTON_IMAGE_LOGIN, BUTTON_LOGIN_ALT).'</div>';
$content .='</form>';
} else {
$content .= '<ul>';
$content .= '<li><a class="loginBoxLinks" href="' . zen_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . LOGIN_BOX_ACCOUNT . '</a></li>';
$content .= '<li><a class="loginBoxLinks" href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . LOGIN_BOX_SHOPPING_CART . '</a></li>';
$content .= '<li><a class="loginBoxLinks" href="' . zen_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . LOGIN_BOX_LOGOFF . '</a></li>';
$content .= '</ul>';
}
$content .= '</div>';
Re: Need solution: Undefined index: customer_id when using sidebox/login_box.php
You could replace
Code:
if(!$_SESSION['customer_id']) {
with
Code:
if(!zen_is_logged_in()) {