The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Forum if condition not working
Not sure what is going on but my if condition is not working. Not sure why but it is getting annoying.
$foruminfo['forumid'] works for showing when you click on the category itself but not when your viewing threads inside a forum. HTML Code:
<if condition="in_array($forum['forumid'], array($vboptions['pl9_qloc']))">
Any help much appreciated. Thanks Steve --------------- Added [DATE]1262664726[/DATE] at [TIME]1262664726[/TIME] --------------- Well a response was here, got an email so here is my reply. As I didn't give the template I'm trying to use this in, I have added this: Code:
navbar Thanks |
#2
|
||||
|
||||
If you look in the includes/functions.php file where the navbar is rendered, you'll see that $forum is not registered for use in that template. However, $foruminfo is registered for use, so try using that variable instead.
|
#3
|
|||
|
|||
Yeah I have it in the conditional already, let me post the full conditional.
HTML Code:
<if condition="in_array($foruminfo['forumid'], array($vboptions['pl9_qloc'])) OR THIS_SCRIPT == 'index' OR in_array($forum['forumid'], array($vboptions['pl9_qloc']))"> <if condition="$vboptions['pl9_quote_display'] == 'table'"> $table </if> <if condition="$vboptions['pl9_quote_display'] == 'styled_table'"> $stable </if> <if condition="$vboptions['pl9_quote_display'] == 'normal_quote'"> $normal </if> <if condition="$vboptions['pl9_quote_display'] == 'styled_quote'"> $snormal </if> </if> Category view with forums Now click into one of those forums and it goes away. EDIT: $vboptions[pl9_qloc] has all forums selected so all forum id's are in the settings row. |
#4
|
||||
|
||||
Oh yikes, and I'm mixed up between vb4 and vb3, sorry about the stuff regarding registering!
You said that what I'm looking for is in the navbar, but I don't see anything different in the navbar when I click on one of the forums from the page you link to. What should I be looking for exactly? Another thing..... when I've had a option field where I input a row of forumids... x,y,z and then I wanted to use them like you are (if in_array etc...), I've had to first explode it in a plugin... ie. I have some forums set in option "verify_forums" (ie. 12,13,14) In my plugin, I have PHP Code:
HTML Code:
in_array($threadinfo[forumid], $verifyforums) |
#5
|
|||
|
|||
Oh yeah sorry, the quote box goes away. Its above the navbar but I forgot to allow guests to see it. Let me change that, just keep refreshing on that first link and you will see it appear.
Good point on the explode, I will give that a try. --------------- Added [DATE]1262668603[/DATE] at [TIME]1262668603[/TIME] --------------- Ok you as a guest can now see the quote box. I'm such an idiot for not remembering to give perms to guests. --------------- Added [DATE]1262668880[/DATE] at [TIME]1262668880[/TIME] --------------- Ok did the explode function and changed the $foruminfo to reflect $pl9_qloc in the array but with $foruminfo['forumid'] it didn't show on any forum page. |
#6
|
||||
|
||||
I see it now. It seems the only forumid it is currently working in is forumid 1. I would try the explode thing cuz I'm pretty sure that is it. The text field is simply a string as an option, so you need to turn it into an array before you can do your in_array condition.
|
#7
|
|||
|
|||
Did the explode, here is what I have in the global_start plugin:
PHP Code:
|
#8
|
||||
|
||||
And your condition is now like this ?
HTML Code:
<if condition="in_array($foruminfo['forumid'], $pl9_quoteloc) OR THIS_SCRIPT == 'index' OR in_array($forum['forumid'], $pl9_quoteloc)">
Also, it looks like in your query, you are only pulling one row. You could just use query_first instead and then you don't have to do the fetch_array stuff: PHP Code:
|
#9
|
|||
|
|||
Oh no, the forumid stuff has nothing to do with the quotes in the database, that is separate. Basically I am just trying to get the if condition to work so it will display the quote box on the forumdisplay page that I choose.
I just changed my if condition to what you suggested as I still had: HTML Code:
<if condition="in_array($foruminfo['forumid'], array($pl9_quoteloc)) OR THIS_SCRIPT == 'index' OR in_array($forum['forumid'], $pl9_quoteloc)">
The following error occurred when attempting to evaluate this template: Code:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in [path]/includes/adminfunctions_template.php(3950) : eval()'d code on line 1 This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish. |
#10
|
||||
|
||||
OK, this is odd because it really is almost exactly the type of condition I use in a mod of mine. (Sorry I took off, sleep was calling.)
Check your options for pl9_qloc - is the data validation type set to Free ? This is exactly my code in my plugin: PHP Code:
HTML Code:
<if condition="is_member_of($vbulletin->userinfo,array(5,6)) AND in_array($threadinfo['forumid'], $verifyforums)">
PHP Code:
HTML Code:
<if condition="in_array($foruminfo['forumid'], $pl9_quoteloc) OR THIS_SCRIPT == 'index' OR in_array($forum['forumid'], $pl9_quoteloc)">
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|