How can I tell easily if to user_ids with many_to_many association are "friends"?
Fri, 03/05/2010 - 18:02
I have set up user's so that they can be associated as many-to-many friends using AssociateUserAsAllies
When someone encounter a new User, I want to display knowing the UserId of the logged in user and the UserId of the profile they are viewing whether they are friends?
How can I do that? Seems like I need a way to pass both UserId of user and UserId of the profile they are looking at and searched whether there is an autogen that would do that for me?
Thanks.

There should be a function like $user->IsUserAsAlliesAssociated($objUser) you can use.
Ah, so if the logged in user is objUserUser and the "friend" is say objAllyUser, it would be:
$objAllyUser->IsUserAsAlliesAssociated($objUserUser)
if($objAllyUser) {
echo "you're friends!";
}
More like
if($objAllyUser->IsUserAsAlliesAssociated($objUserUser)) {echo "you're friends!";
}
right, thanks!
I guess this logic would be placed in the actual view.....? Maybe create a strLabel that is assigned based on the outcome?
Hmmm...get error Call to undefined method ProfileActivityForm::IsUserAsAlliesAssociated()...this should be part of the core autogen, right?
hmm...okay the function is there in the generated code....so why would this be an undefined method?
i think you're calling it as a static method e.g ProfileActivityForm::IsUserAsAlliesAssociated()
that's wrong i think. you need to have created a user object
$objAllyUser->IsUserAsAlliesAssociated($objUserUser)
So am I putting that in the VIEW? What I have is one content is displayed if = 1 and another if =0