![]() |
post pop-up menu conditional
I'm trying to add something to the post popup menu that's conditional based on whether the user is on your buddylist. This is as close as I can guess, but it doesn't seem to work:
<if condition="in_array($post[userid], $bbuserinfo[buddylist])"> Any idea how to make that work? Okay after many hours of poking around and trying different things, at this point I'm guessing my question above doesn't even make sense. I would think what I'm trying to do is very simple, but so far it doesn't seem to be. I want to put a conditional in the postbit template so that "Add {user} to your buddylist" becomes "Remove {user} from your buddylist" if they're already your buddy. At this point I think I have a better chance of building a car that gets 1000 miles to a gallon of water. :( |
The buddy list isn't an array, it's a list of userIDs seperated with spaces. You'll have to use another function.
|
Quote:
PHP Code:
Code:
<if condition="in_array($post[userid], $buddylist)"> |
Thanks for your replies, guys.
I came pretty close to that same solution myself last night, except I didn't initialize the array first* and I was putting the code in showthread.php instead of global.php. Unfortunately I get the same results either way: Code:
Warning: in_array(): Wrong datatype for second argument in /includes/functions_showthread.php(640) : eval()'d code on line 213 Code:
Array *Is that really necessary? For some reason I thought it wasn't. |
Quote:
PHP Code:
see if that helps any, |
Unfortunately it's still not working. :(
Just to be clear, I added this to the bottom of global.php: PHP Code:
HTML Code:
<tr><td><if condition="in_array($post['userid'], $mybuddylist)"> PHP Code:
Code:
Warning: in_array(): Wrong datatype for second argument in /includes/functions_showthread.php(640) : eval()'d code on line 213 |
try this one then, since it's looking for an integer in the array I think...still away from testing computer...
PHP Code:
|
Nope, didn't work unfortunately. Exactly the same results.
|
Well crap dude, I'm stuck then....
Not quite sure where to go from there... Quote:
|
Quote:
Okay I stumbled on a solution, so here it is for posterity. :) I'm not gonna bother posting it in mini-mods since there's probably an easier way: Find in includes/functions_showthread.php: PHP Code:
PHP Code:
HTML Code:
<if condition="$post['userid']"> HTML Code:
<if condition="($bbuserinfo['userid'] AND ($post[userid] != $bbuserinfo['userid']))"> remove_x_from_buddy_list Remove {1} from your Buddy List |
All times are GMT. The time now is 05:00 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:
|