How to install and setup user relationships
The user relationship module can be used to create relationships between users on your drupal site. In this example we’ll be creating a single relationship called “Friends”.
- Drupal 6
- User relationship module (http://drupal.org/project/user_relationships)
- Views module (http://drupal.org/project/views) If you want to integrate with views.
1 Install the module
Go to http://drupal.org/project/user_relationships and download the module and place it in sites/all/modules folder.
Then enable the required modules at Administer >> Site building >> Modules.
Make sure you enable the following modules:
- UR-API, this module is required.
- UR-Mailer, used to send friend request and approval emails.
- UR-UI, creates screens for users to manage relationships.
- UR-Views, integrates the module with views.
2 Create a relationship type
Next let's create a relationship type. To keep this tutorial simple let’s create a single relationship type called “Friend”.
Go to Administer >> User management >> Relationships and click on Add type.
Enter in the name friend and plural name friends. Keep requires approval ticked and tick the authenticated user check box in the role access. Then click on submit.
3 Setting up right permissions
The standard way of friending a user will be to go to their profile page (user/1) and click on a link on that page.
Go to Administer >> User management >> Permissions and set them up as the following:
- Tick access user profile under user module for anonymous user and authenticated user.
- Tick can have relationships under user_relationships_api module for authenticated user.
- Tick maintain own relationships under user_relationships_ui module for authenticated user.
- Tick view user relationships under user_relationships_ui module for authenticated user.
- Scroll to the bottom and click on Save permissions.
4 First test
Now we should test if we can become friends with other users, if you are logged on as admin go to another users profile page. You should see a Become name's friend link.
If you are not seeing the link there could be 2 problems:
- Check that you have setup the right permissions.
- You have customised your themes user-profile.tpl.php file.
5 Setting up emails
Now let's setup the friend request and approval emails. Go to Administer >> User management >> Relationships >> Settings. Scroll down to the Email Options field set, all emails are selected to be sent by default.
Let's be nice to our users and only have the request and approval email sent.
That's it, now you should have a simple friends system on your drupal site using the user relationships module. If anyone has any problems please comment below.