Hi guys. I had a feature/interface idea that I'm having some trouble figuring out.
I have inserted a display of the 10 newest buddies into my custom user profile page.
I would like to add a little icon and some text that says if the given buddy is just a buddy or if the user is also a buddyof the buddy (they are mutual buddies). I am having some trouble writing a condition to do this check. I'm not sure if it would require a sql query or if the data is already available through the buddylist module. I suspect it is, since buddylist already has a "buddy of" page.
Here is the logic of what I'm trying to do:
given we're on user1's profile page:
we are inside a foreach to get all the buddies of user1:
if (user2 is user1's buddy) and (user1 is a buddy of user2) {
display (mutual-icon) (Mutual buddies text);
}
else {
display (buddy-icon) (regular buddy text);
}
break;
As you can probably tell from my pseudo code above, I am very new to php, and I'm not sure exactly how to accomplish the above feature.
If I could get some help on this I would be very appreciative, and I'll definitely post my final code here to share with others.
Comments
Comment #1
dldege commentedhere's a function to get get a buddy of b
You could call this with a,b and then b,a as to get both directions of relationships
Comment #2
ZrO-1 commentedAh yeah, very nice. Thanks dldege!
I'll work on getting this setup as a module, and post the result here.
Comment #3
ZrO-1 commentedHere's what I have so far. Am I on the right track with this? I'd like to get this setup as a full module that maybe could get added as a contrib to buddylist.
Thanks for all the help guys.
Comment #4
designwork commentedHi Zr0-1,
i have some problem. I have a tab that i wanna only show if the current user is a buddy of the userprofile he is at.
Do you have any idea how to do this?
Dirk