Since giving a presentation on social networking in Drupal, a number of people have asked me which “friend” module they should use. It’s a good question, and the answer is of course that it depends on your site. This post should explain the relative advantages and disadvantages of both to help you choose which one will work the best for you.
I got into Drupal 3 years ago, when Drupal 5 was going strong. The first site I built in Drupal was a social network, so one of the first things I did was research which “friend” module to use. Buddylist was basically the only option at the time, but User Relationships was born almost the same day that I chose Buddylist. User Relationships ended up gaining more momentum, and after next-gen efforts for Buddylist died in Buddylist2, User Relationships appeared to have become the dominant “friend” module for Drupal 6. Then FriendList came along. It had a good run – it was supposed to be more flexible and better designed than User Relationships – but the original maintainer burned out, and it hasn’t been updated in over a year. It never got a stable release, so while it probably works just fine, I don't recommend using it. As a result it is not included in this comparison. So by the time the Flag module had its first full stable release for Drupal 6, it looked like User Relationships had already won. But the Flag module allowed custom User flags, and people quickly realized that such a powerful module could be used to create a lightweight “friend” module as well. The result was Flag Friend (which depends on Flag). Flag Friend now stands as the only true competitor to User Relationships.
In terms of usage, Flag Friend (or FF) is used on about 1000 sites, while User Relationships (or UR) is used on nearly 5000 sites (according to Drupal.org statistics). Both are being constantly developed, although only 12% of the issues in the FF queue are open, while 35% of the issues in the UR queue are open. (UR’s 5 times more users mean it has about 5.5 times more issues opened.) The documentation for FF is mediocre while the documentation for UR is fair. Both modules’ last stable release was Release Candidate 4 at the time of writing. There are some basic differences in terms of feature set. Flag Friend provides a single relationship type, “Friend,” which is two-way (meaning if I am your friend, then you are also my friend) and requires the recipient of a friend request to confirm that request. Users can send a message with their friend request to offer further explanation. Email notification for receiving a request is supported. (Note that you can just use the Flag module if you want one-way relationships – and there is no limit on the number of those you can create.) User Relationships, on the other hand, is much more comprehensive. It consists of a whole suite of modules. Multiple relationships are allowed, each of which can be either one-way (think “fan,” “follower,” “manager,” “parent,” “subscriber”) or two-way (“friend,” “colleague,” “sibling”). Either type can optionally require approval. Requests for a relationship can time out if not approved in a certain period of time, or users can set their preferences to automatically approve incoming requests. Submodules allow default relationships (relationships automatically assigned to users when they register), sending messages along with friend requests, implied relationships (“manager” implies “employee”), and email or Privatemsg notifications. AJAX popovers can be used to minimize page refreshes when sending a relationship request. Permissions are also more robust than those in FF. FF also has a “Flag Friend Access” submodule that allows users to specify that only their friends should be able to view a node that they create. This is node-specific; the module adds a checkbox on each node a user creates that lets that user choose whether the node is visible to everyone or just their friends. UR has a similar submodule called “User Relationships Node Access” which lets the administrator specify whether each content type should be visible to everyone or to any user with whom the creator has any relationship. UR Node Access extends a bit beyond the capabilities of FF Access in that the administrator can choose whether the access restrictions apply to just viewing the node or whether a user’s friends can edit or delete the node too. This means that UR might be useful in an editorial environment for colleagues within a department, for instance. Both FF and UR have integration with Views, Activity, Heartbeat, Rules, Advanced Profile Kit, and Facebook-style Statuses. UR also integrates with CCK Field Privacy, Services, and Invite. Both have robust APIs and theme capabilities, although much of Flag Friend’s strength there stems from the Flag module it extends. The Flag API is well-documented, but FF itself has no API documentation. UR does have API documentation in the README files for its respective submodules, but the API documentation on Drupal.org is deceptively for the 5.x-2.x branch. Flag Friend is extraordinarily easy to use and requires virtually no setup apart from enabling the default “Friend” flag (which takes no more effort than clicking “Enable”). If you want, you can configure the text of the “friend” link, but the defaults should be fine for most use cases. Once the “Friend” flag is enabled, a link appears on users’ profiles to add them as a friend. If the Views module is installed, there is also a tab on users’ profiles to see friends and pending requests. User Relationships requires slightly more configuration. The process of creating a new relationship is straightforward, but the terms used can be mildly confusing to new users. Once a relationship is created, the process of actually “friending” a user is the same as in Flag Friend: a link appears on users’ profiles, and there is also a page listing relationships and pending requests.
A 2.x branch is being developed for Flag Friend which will allow multiple relationships (not just the single “Friend” relationship allowed by the 1.x branch). However this is still under heavy development. Both UR and FF are being ported to Drupal 7, although the UR port is being more actively pursued at the time of writing. Neither has officially joined the D7CX movement, but you can be assured that both will have stable releases for Drupal 7 sooner or later. New competitors look unlikely.
Normally, two projects with the same goals would be encouraged to join efforts. In this case, however, they are different enough that this is unlikely and probably unnecessary. User Relationships is a large, stand-alone suite of modules, while Flag Friend is a lightweight alternative based on the Flag module. Both have their advantages and disadvantages, but both are also quite capable. I used Flag Friend on the demo site I built for my social networking presentation because I wanted something simple with minimal configuration, and because I already had Flag installed. Which one you should use depends on whether you need any of UR’s extra features (primarily multiple two-way relationships), which node access setup you prefer, and whether you are already using the Flag module. What’s your preference? Please explain in the comments. This post is part of a series on Social Networking. Future topics may include the future of social streams in Drupal, social networking features missing from Drupal (and how we can fix that), and integrating the Activity module with Facebook-style Statuses. You can find other posts on social networking on Isaac’s website.