Store
Community Documentation

v3 Knowledgebase

Check if 2 Users Are Friends

To check if 2 users are friends we use the friend module isFriend method.

This service file can be found here:
/module/friend/include/service/friend.class.php

Use the following method to check if 2 users are friends:
PHP:
if (Phpfox::getService('friend')->isFriend(12))
{
    
// They are friends

This method requires 2 params both being the users ID#. The method will return a boolean TRUE if the 2 users are friends and a FALSE if not. In the example above we checked if user ID# 1 is friends with user ID# 2.