The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
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. ![]() |
#2
|
||||
|
||||
![]()
The buddy list isn't an array, it's a list of userIDs seperated with spaces. You'll have to use another function.
|
#3
|
||||
|
||||
![]() Quote:
PHP Code:
Code:
<if condition="in_array($post[userid], $buddylist)"> Remove $post[username] from your buddylist<br /> <else /> Add $post[username] to your buddylist<br /> </if> |
#4
|
||||
|
||||
![]()
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 ( [0] => 2 ) *Is that really necessary? For some reason I thought it wasn't. |
#5
|
||||
|
||||
![]() Quote:
PHP Code:
see if that helps any, |
#6
|
||||
|
||||
![]()
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)"> Remove $post[username] from your buddylist<br /> <else /> Add $post[username] to your buddylist<br /> </if></td></tr> PHP Code:
Code:
Warning: in_array(): Wrong datatype for second argument in /includes/functions_showthread.php(640) : eval()'d code on line 213 Warning: in_array(): Wrong datatype for second argument in /includes/functions_showthread.php(640) : eval()'d code on line 213 Warning: in_array(): Wrong datatype for second argument in /includes/functions_showthread.php(640) : eval()'d code on line 213 Array ( [0] => 2 ) |
#7
|
||||
|
||||
![]()
try this one then, since it's looking for an integer in the array I think...still away from testing computer...
PHP Code:
|
#8
|
||||
|
||||
![]()
Nope, didn't work unfortunately. Exactly the same results.
|
#9
|
||||
|
||||
![]()
Well crap dude, I'm stuck then....
Not quite sure where to go from there... Quote:
|
#10
|
||||
|
||||
![]() 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']"> <tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&userlist=buddy&u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr> </if> HTML Code:
<if condition="($bbuserinfo['userid'] AND ($post[userid] != $bbuserinfo['userid']))"> <if condition="($isbuddy == false)"> <tr><td class="vbmenu_option"><a href="$vboptions[bburl]/profile.php?$session[sessionurl]do=addlist&userlist=buddy&u=$userinfo[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr> <else /> <tr><td class="vbmenu_option"><a href="$vboptions[bburl]/profile.php?$session[sessionurl]do=removelist&userlist=buddy&u=$userinfo[userid]"><phrase 1="$post[username]">$vbphrase[remove_x_from_buddy_list]</phrase></a></td></tr> </if> </if> remove_x_from_buddy_list Remove {1} from your Buddy List |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|