User Name Stays on NavBar after Logging Out

Open to all! Ask other shopowners for help.
Moxamint
Member
Posts: 93
Joined: Fri Nov 06, 2020 10:36 am
Phoenix Version:
Has thanked: 33 times
Been thanked: 3 times

Re: User Name Stays on NavBar after Logging Out

Post by Moxamint »

raiwa wrote: Sat Dec 31, 2022 9:03 am Possible core change in the navbar module:
includes\modules\navbar\nb_account.php line 20:

Code: Select all

      if ( ($GLOBALS['customer'] ?? null) instanceof customer && isset($_SESSION['customer_id']) ) {
This works as well.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: User Name Stays on NavBar after Logging Out

Post by Kofod95 »

Moxamint wrote: Sat Dec 31, 2022 12:02 pm [...] but how come you know exactly when the lunar new year will be?
We recently received the Davidoff and the Macanudo cigars celebrating the arrival of the Year of the Rabbit, so when I created the products, I did some reading ;)

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: User Name Stays on NavBar after Logging Out

Post by raiwa »

raiwa wrote: Sat Dec 31, 2022 9:03 am Possible core change in the navbar module:
includes\modules\navbar\nb_account.php line 20:

Code: Select all

      if ( ($GLOBALS['customer'] ?? null) instanceof customer && isset($_SESSION['customer_id']) ) {
@ecartz Could this go into 1.0.8.21/1.0.9.0?
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: User Name Stays on NavBar after Logging Out

Post by ecartz »

raiwa wrote: Mon Jan 02, 2023 9:43 am @ecartz Could this go into 1.0.8.21/1.0.9.0?
Try: save

Code: Select all

<?php
/*
  $Id$
  CE Phoenix, E-Commerce made Easy
  https://phoenixcart.org
  Copyright (c) 2023 Phoenix Cart
  Released under the GNU General Public License
*/

  class global_eraser {

    public function __call($name, $arguments) {
      unset($GLOBALS[$name]);
    }

  }
at includes/classes/magic/global_eraser.php and add

Code: Select all

INSERT INTO hooks (hooks_site, hooks_group, hooks_action, hooks_code, hooks_class, hooks_method) VALUES ('shop', 'logoff', 'resetStart', '_41_unset_customer', 'global_eraser', 'customer');
My test shop is down, so I can't test/try anything until I build a replacement. But I'd prefer not to change the logic, if customer, then do stuff with customer. I'd rather change whether or not the customer object exists. That will also be more robust in other features with the same logic.
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: User Name Stays on NavBar after Logging Out

Post by raiwa »

ecartz wrote: Mon Jan 02, 2023 12:38 pm
raiwa wrote: Mon Jan 02, 2023 9:43 am @ecartz Could this go into 1.0.8.21/1.0.9.0?
Try: save

Code: Select all

<?php
/*
  $Id$
  CE Phoenix, E-Commerce made Easy
  https://phoenixcart.org
  Copyright (c) 2023 Phoenix Cart
  Released under the GNU General Public License
*/

  class global_eraser {

    public function __call($name, $arguments) {
      unset($GLOBALS[$name]);
    }

  }
at includes/classes/magic/global_eraser.php and add

Code: Select all

INSERT INTO hooks (hooks_site, hooks_group, hooks_action, hooks_code, hooks_class, hooks_method) VALUES ('shop', 'logoff', 'resetStart', '_41_unset_customer', 'global_eraser', 'customer');
My test shop is down, so I can't test/try anything until I build a replacement. But I'd prefer not to change the logic, if customer, then do stuff with customer. I'd rather change whether or not the customer object exists. That will also be more robust in other features with the same logic.
Confirmed. Works like expected.

Thank you very much and a Happy New Year
Rainer
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply