User Name Stays on NavBar after Logging Out
-
Moxamint
- Member
- Posts: 93
- Joined: Fri Nov 06, 2020 10:36 am
- Phoenix Version:
- Has thanked: 33 times
- Been thanked: 3 times
User Name Stays on NavBar after Logging Out
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.
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.
Last edited by Moxamint on Fri Dec 30, 2022 12:02 pm, edited 2 times in total.
- tessthepup
- Certified Developer
- Posts: 383
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: User Name Stays on NavBar after Logging Out
If you mean when directed to the logoff.php page then yes
-
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
Thanks for the confirmation. Isn't it a little odd for it to behave like that?tessthepup wrote: ↑Fri Dec 30, 2022 11:58 amIf you mean when directed to the logoff.php page then yes
- tessthepup
- Certified Developer
- Posts: 383
- Joined: Mon Mar 01, 2021 5:55 pm
- Phoenix Version:
- Has thanked: 47 times
- Been thanked: 62 times
Re: User Name Stays on NavBar after Logging Out
to be honest I have never thought about it as a problem, maybe one of the team could comment.Moxamint wrote: ↑Fri Dec 30, 2022 12:01 pmThanks for the confirmation. Isn't it a little odd for it to behave like that?tessthepup wrote: ↑Fri Dec 30, 2022 11:58 amIf you mean when directed to the logoff.php page then yes
- 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
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
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
- burt
- Core Team
- Posts: 4555
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: User Name Stays on NavBar after Logging Out
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:
The idea is to replace the "Customer Name" with the original dropdown title, when logoff.php is accessed.
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;
}
}
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
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
Adding the code above in templates/override/includes/hooks/shop/logoff.php did not fix the issue.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:
The idea is to replace the "Customer Name" with the original dropdown title, when logoff.php is accessed.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; } }
Happy Year of the Rabbit! (Glad to see you here again @burt )
- 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
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
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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
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
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: User Name Stays on NavBar after Logging Out
Possible core change in the navbar module:
includes\modules\navbar\nb_account.php line 20:
includes\modules\navbar\nb_account.php line 20:
Code: Select all
if ( ($GLOBALS['customer'] ?? null) instanceof customer && isset($_SESSION['customer_id']) ) {
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
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
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
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!
This works!
Cheers, Eddy
Last edited by Moxamint on Sat Dec 31, 2022 12:30 pm, edited 1 time in total.