Documentation
Liferay provides a rich store of resources and knowledge to help our community better use and work with our technology.
Liferay's social portlets
Liferay has many portlets available for social interaction and collaboration. Some of these portlets are designed to help you work together as a team, while others are designed to foster social interactions between team members at your organization.
Some of the social portlets should be used on the public pages of your portal, while others should be used as part of a user's personal site. As you might guess, the portlets for personal page use are more focused on simple social interactions, while the ones which can be placed on any site help improve productivity.
Unless otherwise noted, these portlets are all provided with minimal configuration options. Most of them have two configuration options--the option to change permissions for the portlet view and sharing options for connecting the portlet to other web sites. They do not have any way to change options like feed length or display styles. Some styling changes, however, can be done through custom CSS.
Installing the social portlets
The social portlets are all included with the Liferay Community Edition distribution, but need to be installed separately for Enterprise Edition. If you're using Liferay Enterprise Edition, or had previously removed the social portlets from Community Edition, you can use Liferay's plugin installer to easily add social features to your portal.
If you're logged in as an adminstrator, go to the control panel, and in the Server section, click on Plugins Installation. From here, click on Install More Portlets and search for Social Networking. Once the results come up, select the latest version of the Social Networking Portlet, and then click Install. Once the install process finishes, you can start using the social networking portlets.
Using social networking on public pages
There are several social portlets that are designed for use on regular portal pages. The goal of these is to use social connections to help a group work together more closely. These include the Members portlet, Meetups, Top Users, Summary, and Activities.
Figure 8.1: The Members Portlet
The Members portlet is a simple list of all the current site's members. The only configuration options you have are permissions, which are the same for every portlet. For example, you might change the permissions so that only members of the current site can view the portlet.
Figure 8.2: The Meetups Portlet
The Meetups portlet is a tool for creating casual meetings for users of your portal. Anyone can create a "meetup" and give it a title, description, date/time, maximum number of attendees, price, and provide an image. Any meetups that are created are displayed in the portlet for anyone to view. Users can register for the meetup, which lets the organizer keep track of who's coming.
The options for creating a meetup are essentially the same as those for creating a calendar event, and the Meetups portlet shares some functionality with the Calendar. For more information on the Calendar portlet and configuring events, see chapter 4.
Figure 8.3: The Activities Portlet
The Activities portlet comes in two varieties: the standard Activities portlet and the Members' Activities portlet. The basic function of the portlets are the same--they both display a feed of what users are doing on the portal. The difference is that Activities displays what's going on across the entire portal, while Members' Activities displays only what members of the current site have been doing.
Using social networking on personal pages
In addition to the portlets available for general use, there are a handful that can be used only on personal pages. These portlets can be used to create a profile page, similar to Facebook or Google+.
Figure 8.4: Social Networking Portlets in a Facebook-like Layout
The Summary portlet provides a quick overview of a user's profile. When posted in a user's personal site, it displays the user's name, profile picture, and job title. Users can add additional personal information by clicking on Edit in the portlet and filling in information in the About Me section.
This portlet is also essential to any social implementation on Liferay, because it has the Friend Request button. This enables users to initiate social relationships. Note that this portlet simplifies a much more powerful underlying social networking API that defines many different kinds of relationships, including friends. Your developers can take advantage of this API to create powerful social applications. For more information on this, see Liferay in Action (Manning Publications) or the Liferay Developer's Guide.
The Wall portlet provides a place for users to leave messages on other users' profiles. The messages can only be plain text, and no formatting or HTML is supported. Once a post is added to their wall, users have the ability delete it or respond to it with a quick link to post on the original poster's wall.
The Friends portlet shows a list of all the user's friends with links to their profiles. The Friends' Activities portlet shows things a user's friends are doing on the portal.
The map is a tool which enables you to view the locations of other users on the portal, both locally and internationally. In order to configure the map, you need to install the IP Geolocator portlet (available from Liferay's community repository) and configure Maxmind GeoIP or GeoLite on your server. For more information on configuring geolocation services, visit the MaxMind support page at http://www.maxmind.com/app/installation?city=1
Figure 8.5: The Map Portlet
Liferay ships with a nice suite of social networking applications that lets you power your site for social interaction. Now that we've discussed what these portlets do, let's put them all together and make a social web site.
Liferay's social tools in action
To get started with Liferay's social features, let's set up the public pages of our users' personal sites to include social apps. Because of Liferay's flexible page layout options, we have a large number of options for how to set the pages up. For simplicity's sake, we'll make something that's fairly similar to the original Facebook layout.
Setting up users' personal pages
Before we start adding portlets to pages, we should configure Liferay so that everyone (or some subset of everyone) has the same social features. We have two ways to do this, with some advantages and disadvantages to each.
User Groups: Placing users into a group enables you to create a user group site for them. The pages and portlets defined by the user group site are copied to members' personal sites. With the user group site, you can control whether users can modify pages, and you can push changes out to users in the future. Once the site template is assigned to a user group, you can set the Default User Associations to have all users be the member of a particular group in Portal Settings in the control panel. The advantage of this is that it can be managed entirely through the GUI and it's easy to configure. If you base your user group's site on a template, you can use the Enable propagation of changes from the site template option to manage all user pages simply by changing the template. This is the recommended way to manage personal pages across the portal. For more information on user group sites, see chapter 12.
Portal Properties Configuration: The legacy way to do this is with the configuration file. You can specify a default layout and portlets for personal pages in your portal-ext.properties file. If you don't want users to be able to modify their own pages, you should set the layouts to be static by adding the following line to your portal-ext.properties file:
layout.user.public.layouts.modifiable=false
Note that the this method applies changes to the personal sites of all users of the portal. However, it does not provide as much maintainability or customizability as using user group sites. Using user group sites allows you to choose what's modifiable by the user. For more information on the portal-ext.properties method, see Default User Private Layouts and Default User Public Layouts in chapter 14.
Because it's the recommended method, we'll use the user group method to create the layouts. As an administrator, go to the control panel, and select Site Templates from under the Portal section. Click Add and fill out the form. We'll call our new site template Social Layout. Click Save.
Figure 8.6: Creating the Site Template
tip
Tip: Setting the property which disables modifications to personal page layouts disallows users across the portal from making modifications to their personal sites. Unchecking Allow Site Administrators to Modify the Pages Associated with this Site Template will only prevent users from modifying the specific pages contained in the template, but will not disable a user's ability to add or modify additional pages.Once you've created the template, choose Actions → Manage Pages for Social Layout from the Site Templates page, and then click View Pages. Let's change the name of the page from the default to My Profile and add some portlets to the page. In the screenshot below, we removed the borders to make the page look more integrated, and also used Nested Portlets to make the layout more interesting.
Figure 8.7: Social Profile Site Template
Back in the control panel, select Users and Organizations from the Portal section. Once there, click Add → User Group. Name the group Social Users. When creating a user group, you have the option to set a user group site; use this option and select the Social Layout template for your Public Pages.
Now, go to Portal Settings and select Users from the submenu. From the Users page, go to the Default User Associations tab and enter Social Users in the User Groups section. Now all users on the portal get a Social Profile page. Now the question is, how do we encourage users to visit each other's fancy new profile pages?
Connecting users through collaboration
There are many ways that social networks connect users. These generally involve some kind of mutual interest or experience. On a site like Facebook, you can connect with people from school, from work, or from other personal connections. On a music based networking site like Last.fm, you can connect with people who like the same musicians that you do, or have similar tastes. With Liferay's social networking, collaboration is the key to connection.
Using to our example site of nosester.com, we can take a closer look at ways that users can be connected through hierarchies, and ways that they can connect to each other. We'll look at a handful of portlets, both those that are designed specifically for connecting users, and those that can create connections as a side-effect of just getting work done.
The Directory portlet can provide a simple way for users to connect. If we have a site dedicated to people with big noses, we can place a directory portlet on that site, listing all the users that have joined that site. Users can connect by sending requests to other users on that list. This isn't the worst way to get users connected, but it probably won't be very effective. Why not? Well, other than sharing some very basic common interests, we haven't really had any interactions.
The Activities portlet provides a similar, but more effective means of connection. Because it shows a list of what other users are doing, this portlet helps users discover who is among the most active across the site or the portal, and thus who might be a good connection.
Probably the most effective way users can connect is by interacting with other users. Every portlet in the Collaboration category provides information on who is contributing, regardless of how. You can see who is creating a thread in a message board, editing a wiki article, blogging, or creating a calendar event. Users can use these to connect based on content--if I find your blog interesting, or if you answer my question on the message board, we can use that as a point to connect as friends to further our interactions. This way, instead of our connection being forced or abitrary, we've connected based on the fact that we've directly interacted and share a common interest--just like people did before they had the internet.
"Friend" is only the default social relationship as implemented by Liferay's social portlets. You can design things so that users are automatically connected through Site and Organization membership. And there are many other relationship types beyond Friend: your developers can take advantage of these by using Liferay's social API. This is covered in Liferay in Action and the Liferay Developer's Guide.
Beyond Liferay's API, there is also support for the OpenSocial standard.