The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to check in sidebar (forum blocks) if user is logged in?
How can I check in the forum blocks that are displayed in the new sidebar whether a user is logged in, and display different content accordingly?
I tried the old... Code:
// IF THE USER IS LOGGED IN if ($bbuserinfo[userid]) { // CODE TO EXECUTE IF THE USER IS LOGGED IN } else { // CODE FOR GUESTS } |
#2
|
||||
|
||||
in php, you use $vbulletin->userinfo, not $bbuserinfo. And, in the blocks it *may* be vB::$vbulletin->userinfo.
|
#3
|
|||
|
|||
Thanks - the following worked:
Code:
if (vB::$vbulletin->userinfo[userid]) { echo "logged in"; } else { echo "not logged in"; } |
#4
|
||||
|
||||
echo is the culprit. Look at the template the output is going to and the name of the variable you should be using is in there (I can't remember it - it might be $output, but may be something else).
To find the template to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. |
#5
|
|||
|
|||
The template is block_html and in that template I found the following variable: {vb:raw content}
I was not sure how to modify that variable though. Then I found this, and it seems to work: Code:
if (vB::$vbulletin->userinfo[userid]) { $my_output = "you are logged in"; return $my_output; } else { $my_output = "you are not logged in"; return $my_output; } |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|