Announcement

Collapse
No announcement yet.

$show['member'] doesn't work in header template after logout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $show['member'] doesn't work in header template after logout

    On our forums we have the navbar links "UserCP, FAQ, Members List, Calender etc" in our header template rather than the navbar template. We have been having the problem that when you click logout, it still says "Welcome, username" and the navbar links (that are in our header template rather than navbar template) still show as they would when the user is logged in. They don't display correctly for a logged out user until the page is refreshed.

    Now with the 3.5.2 update and the change to the navbar template as mentioned in the announcement thread, after you click logout it no longer says "Welcome, user" and shows the login box as it should, but the navbar links in my header template still show as they would for a user logged in until the page is refreshed (and I did replace instances of "<if condition="$bbuserinfo['userid']">" as it says in the announcement). It seems $show['member'] used in the if condition around the navbar links returns that a user is logged in when it is evaluated in the header template but returns that the user isn't logged in when its evaluated in the navbar template (why is this?).

    To test this I created a new style with no parent style, and then changed the header template to contain exactly the same code as the default navbar template, effectively creating two navbars on the forums. Then when logged in I clicked logout, and the top navbar (in the header template) showed links as if I was still logged in and the bottom navbar (in the navbar template) showed links correctly for a logged out user.

    For people who have their navbar links in the navbar template this isn't a problem I doubt, but its just annoying for our forums when you logout. How can I get it to display the navbar links correctly (as it does in the navbar template) when logout is clicked?

  • #2
    I am sorry, but I don't quite understand why you don't just revert the template navbar so it uses the latest code, which by your test: works?

    Comment


    • #3
      Thanks for replying. Reverting the template won't work from what I can see. I think a screenshot will help. Even if I create a new style on 3.5.2 with no parent style so it is using the default template for navbar, if I copy the default navbar links code into the header template (where we have the navbar links on our forum) it is for some reason evaluated different to the exact same code in the navbar template.

      So I have created a new style, and to simulate the navbar links code being in the header template rather than the navbar template, I just deleted the entire contents of the header template and replaced it with the contents of the default navbar template, effectively creating two navbars as shown here. Its a bit of a rough and ready way of doing it but it proves the problem. Then when I click logout I get this, despite the fact that the exact same default navbar template code is in the navbar template and the header template. The navbar code in the header template acts as if I am still logged in, and the exact same code in the navbar template acts as if I am now logged out.

      Its as if the value of $show['member'] is changed between when the header template is evaluated and when the navbar template is evaluated. Because in our forums style we have our navbar links (UserCP, Faq, Members List etc) in our header template rather than our navbar template, this causes the links to show incorrectly when you have just logged out.

      Comment


      • #4
        Why is the same template code producing different results depening on which template it is executed within? Thats what appears to be happening to me.

        Comment


        • #5
          This is because not all varibles are available to every template.
          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
          Change CKEditor Colors to Match Style (for 4.1.4 and above)

          Steve Machol Photography


          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


          Comment


          • #6
            But the navbar link code works fine everywhere else (shows correctly if you are logged in or out). Its just when logging out it does this. Weird. Perhaps I might try moving the navbar links code into the navbar template rather than having it in the header template.

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X