![]() |
Checking for notice being shown
I have about 4 different notices that display according to certain conditions. e.g. Guest Message, Never Posted etc.
Is it possible to test that a particular notice is being shown on a page the user is on, so I can then run some code in the header? pseudo code: Code:
if noticeshown=Guest Message then Jon |
If the notices you want to check are not marked "persistent" then you can check for the id in the array $vbulletin->np_notices_displayed like:
Code:
<if condition="!empty($vbulletin->np_notices_displayed[3])"> That doesn't work for persistent notices. Also, the ids aren't really displayed anywhere but you can see them in the url (if your browser displays it when you hover over a link) by going to the Notice manage and hovering over the notice name. It might be a better idea (depending on exactly what you want to do of course) to check the conditions yourself. For instance, if a notice is guests only you could check for <if condition="!$show['member']">. |
Alas, they are persistent notices, so maybe your alternative idea might be the better option. What does $show['member'] actually mean?
|
$show['member'] gets set to true if a member is logged in, and it'll be false if it's a guest viewing the page. So you can use it in a template condition to change what guests see vs. members.
That probably is a better way to go in general, unless you actually wanted to know if the notice was displayed or not (as opposed to whether or not the user is a guest). But I think if the notice is persistent it amounts to the same thing (oh..ah, unless it's dismissible). |
All times are GMT. The time now is 02:20 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|