Another approach for building social networking sites is to use Drupal's Organic Groups (OG) module. This module provides the ability for users on your site to create their own "group," where a group consists of a homepage and the ability for other users to join and create content. You can think of OG as the Drupal version of Yahoo or Google Groups. An excellent example of a site built using OG is www.popsugar.com/community/groups.
Setting up Organic Groups is a relatively simple process that begins with installing the OG module and its dependencies. Other modules required by OG are Notifications, Messaging, and Tokens. Follow the instructions found in Chapter 8 for installing and enabling modules.
After you get the right modules installed, you need to set up a group node and group post. The group node is used to configure a new organic group and a group post is the content type used by members of a group to create content. Following the directions in Chapter 10, create both content types as described here.
For the group node, use Set-up an Organic Group as the title and set_up_an_organic_group as the name of the content type. On the submission forms setting, enter Group Name in the title and Welcome Message for the body. For workflow settings, uncheck the promote to the front page option and disable attachments. In the Organic Groups section, select the Group node option, and, finally, disable comments.
For the group post node, use Group Post as the title and group_post as the name of the content type. On the submission form settings and workflow settings page, leave the default values. On the Organic Groups section, select either Standard group post or Wiki group post. The difference between the two options is that a Standard group post may be edited only by the author and the group administrator, whereas a wiki post can be edited by any member of the group. It's a good idea to leave the ability to comment on posts enabled, as that's a standard approach for most group websites.
With the content types in place, the next step is to configure the OG module. On the Configuration page, find the section for Organic Groups. There are two configuration options: Organic Groups Configuration and Organic Groups Access Configuration. On the Organic Groups Configuration page, you will find three categories of configuration options: Content types, Group details, and Messaging & Notifications.
The Content types configuration options were automatically set when we created the new OG content types. You can look at the options to see the values that were set in the previous step, but you shouldn't have to change any of the values. You'll see that the Set Up an Organic Group node is set to the default Group node and Group Post is set to the standard group posting content type. You shouldn't have to change any values.
The Group details configuration options control whether groups appear in the groups directory, whether the group appears on the group registration form, whether the groups that a user belongs to are displayed on their profile, whether a user must select a group when creating a post, and the default view used to create the homepage for that group. For demonstration purposes I'll leave all of the settings at their default values.
The Messaging and Notifications configuration options allow you to customize the content generated when a message is sent to a user. There are several tokens that you can use to embed values such as user name or group name into the body of a message. For demonstration purposes I'll leave all of the values set to their defaults.
The OG module provides a number of blocks that enable users and administrators to create, join, and participate in groups. The standard blocks include:
New groups. This block provides a list of the groups that were recently created.
My groups. If the user is logged in, this block displays a list of groups to which the user belongs.
Group details. This block provides the links for group members to create a group post, invite a friend, manage their membership, see the number of members, and the designated group manager.
Group search. This block provides the ability to search content within the group.
Group notifications. This block enables the group feed options and is active once the user enters the group.
Group admins. This block provides the same information as in group details, but directed at the administrator of the group.
Group members. This block lists all of the members in a group.
Group files. This block lists all of the files associated with this group.
For demonstration purposes, I'll assign every block to the right sidebar of my test site. You may assign the blocks that make sense to your site to any region you desire.
The next step in the process is to set up the access configuration for OG. On the Configuration page, you will find an option called "Organic groups access configuration. On the configuration page you will find two options, one for setting the visibility of posts on your site and the second option defines how private groups are handled. For the visibility of posts settings, you have the option of defining whether posts are visible only within a specific group or across all groups, or whether you want the author to have the ability to specify if the visibility of the post. I'll leave the default option that specifies that the posts are only visible within the designated group.
The second configuration option defines whether new groups are visible to the public. You can set groups to automatically default to public or private, or you can allow the group administrator to set the visibility of the group. For demonstration purposes I'll leave the default option set so that every new group is automatically set to public.
There are several permissions that you will need to set before creating your first group. You will first need to decide whether you will have a special role for users who will create and administer groups. If you want any user on your site to have the ability to create a group, you can just use the authenticated user role. If you want to restrict who can create new groups then you'll need to create a specific role (e.g., group administrator) and assign that role to the users who will have the ability to create and manage groups. For demonstration purposes I'll set up my site so that any authenticated user can create and administer their own groups.
The permissions that I'll set to enabled for authenticated users are create setup_organic_group content create group_post content delete own group_post content edit own group_post content edit own setup_organic_group content og_notifications module - subscribe to content in groups
I'll leave the "administer organic groups" permission unchecked, as I only want the site administrator to have the ability to change global organic settings.
Was this article helpful?