Page 1 of 2
User Name Stays on NavBar after Logging Out
Posted: Fri Dec 30, 2022 11:55 am
by Moxamint
Hi All,
As stated in the Subject, the user name will still show on the Navbar after logging off until I start doing something else. Does anyone have the same issue?
I am running 1.0.8.20.
Re: User Name Stays on NavBar after Logging Out
Posted: Fri Dec 30, 2022 11:58 am
by tessthepup
Moxamint wrote: ↑Fri Dec 30, 2022 11:55 am
Hi All,
As stated in the Subject, the user name will still show on the Navbar after logging off until I start doing something else. Does anyone have the same issue?
I am running 1.0.8.20.
If you mean when directed to the logoff.php page then yes
Re: User Name Stays on NavBar after Logging Out
Posted: Fri Dec 30, 2022 12:01 pm
by Moxamint
tessthepup wrote: ↑Fri Dec 30, 2022 11:58 am
Moxamint wrote: ↑Fri Dec 30, 2022 11:55 am
Hi All,
As stated in the Subject, the user name will still show on the Navbar after logging off until I start doing something else. Does anyone have the same issue?
I am running 1.0.8.20.
If you mean when directed to the logoff.php page then yes
Thanks for the confirmation. Isn't it a little odd for it to behave like that?
Re: User Name Stays on NavBar after Logging Out
Posted: Fri Dec 30, 2022 12:15 pm
by tessthepup
Moxamint wrote: ↑Fri Dec 30, 2022 12:01 pm
tessthepup wrote: ↑Fri Dec 30, 2022 11:58 am
Moxamint wrote: ↑Fri Dec 30, 2022 11:55 am
Hi All,
As stated in the Subject, the user name will still show on the Navbar after logging off until I start doing something else. Does anyone have the same issue?
I am running 1.0.8.20.
If you mean when directed to the logoff.php page then yes
Thanks for the confirmation. Isn't it a little odd for it to behave like that?
to be honest I have never thought about it as a problem, maybe one of the team could comment.
Re: User Name Stays on NavBar after Logging Out
Posted: Fri Dec 30, 2022 12:55 pm
by Kofod95
That behavior appeared sometime between 1.0.4.0 and 1.0.7.12. I would think the name shouldn't show, as that seems counter-intuitive when the message says you are logged out, but I wouldn't regard it as something of high priority to fix.
//Daniel
Re: User Name Stays on NavBar after Logging Out
Posted: Fri Dec 30, 2022 2:03 pm
by burt
This is normal as the logoff page destroys the session and then the next page click reloads the navbar. Some time back I coded up a quick and easy solution (I don't recall who for, but as it's my code I know I can share it as I like). If you can test this (as it was probably made for a single language shop, and I am not sure which Phoenix version [but that should not be an issue]) let me know if it works, it can be added as the first PRO addon of 2023.
File (
assuming using override template, if using a different template change the file location appropriately):
templates/
override/includes/hooks/shop/logoff/navbar.php
In that new file:
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 hook_shop_logoff_navbar {
function listen_injectSiteEnd() {
$text = MODULE_NAVBAR_ACCOUNT_LOGGED_OUT;
$logoff_text = <<<LT
<script>
$('#navDropdownAccount').html('$text');
</script>
LT;
return $logoff_text;
}
}
The idea is to replace the "Customer Name" with the original dropdown title, when logoff.php is accessed.
Re: User Name Stays on NavBar after Logging Out
Posted: Sat Dec 31, 2022 12:38 am
by Moxamint
burt wrote: ↑Fri Dec 30, 2022 2:03 pm
This is normal as the logoff page destroys the session and then the next page click reloads the navbar. Some time back I coded up a quick and easy solution (I don't recall who for, but as it's my code I know I can share it as I like). If you can test this (as it was probably made for a single language shop, and I am not sure which Phoenix version [but that should not be an issue]) let me know if it works, it can be added as the first PRO addon of 2023.
File (
assuming using override template, if using a different template change the file location appropriately):
templates/
override/includes/hooks/shop/logoff.php
In that new file:
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 hook_shop_logoff_navbar {
function listen_injectSiteEnd() {
$text = MODULE_NAVBAR_ACCOUNT_LOGGED_OUT;
$logoff_text = <<<LT
<script>
$('#navDropdownAccount').html('$text');
</script>
LT;
return $logoff_text;
}
}
The idea is to replace the "Customer Name" with the original dropdown title, when logoff.php is accessed.
Adding the code above in templates/override/includes/hooks/shop/logoff.php did not fix the issue.
Happy Year of the Rabbit! (Glad to see you here again
@burt )
Re: User Name Stays on NavBar after Logging Out
Posted: Sat Dec 31, 2022 6:58 am
by Kofod95
Maybe:
templates/override/includes/hooks/shop/logoff/navbar.php
Good to see you again, Burt, and thank you very much for sharing an actual solution!
BTW, @Moxamint, I was under the impression that the Year of the Rabbit would begin at January 23rd (that is when all the cigars celebrating it will be released) - but I wish the same to you!
//Daniel
Re: User Name Stays on NavBar after Logging Out
Posted: Sat Dec 31, 2022 9:03 am
by raiwa
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']) ) {
Re: User Name Stays on NavBar after Logging Out
Posted: Sat Dec 31, 2022 12:02 pm
by Moxamint
Kofod95 wrote: ↑Sat Dec 31, 2022 6:58 am
BTW, @Moxamint, I was under the impression that the Year of the Rabbit would begin at January 23rd (that is when all the cigars celebrating it will be released) - but I wish the same to you!
//Daniel
Thanks
@Kofod95 for the fix, but how come you know exactly when the lunar new year will be? Can't wait to have a quiet, peaceful holiday when all my neighbors go out to stuck in a traffic jam!
Kofod95 wrote: ↑Sat Dec 31, 2022 6:58 am
Maybe:
templates/override/includes/hooks/shop/logoff/navbar.php
//Daniel
This works!
Cheers, Eddy