Creating Discussion Forums using Liferay
-
font size
decrease font size
increase font size
Setting Up a Forum
The Message Boards application that you’ll use to set up the portal’s discussion forum is listedin the Collaboration category. To use this application, first set up a new page for the discussionforum:
1. Log in to our ISI portal using the Admin account.
2. Add a new page called Forum in the Fundamental Analysts community.
3. Use the Add Application menu to add the Message Boards application to the Forumpage.
The screenshot for adding Message Boards is shown in Figure 4-1.

The Message Boards application provides these tabbed menus:
• Categories
• My Posts
• My Subscriptions
• Recent Posts
• Statistics
• Banned Users
The Categories menu option allows you to define new categories and manage existingcategories. Generally, a discussion forum contains categories associated with different topicsor types of users. For example, in the securities portal you might want two categories: one forfundamental analysts and the other for technical analysts. Offering discussion-forum categoriesmakes it easier for users to find and focus on what they want.As a user, you might be posting messages to the forum. The My Posts menu option lets youview all your posts, monitor them, and edit them.You can also offer your users the ability to subscribe to a particular discussion on theforum. A subscribed user receives notification whenever new messages are posted or newchanges are made on the given topic. The My Subscriptions menu option allows you to viewand monitor all your subscriptions.The Recent Posts menu option displays all recent posts. This saves you the trouble of sortingthe posts by date and listing all the latest ones.The Statistics menu option provides information on the number of categories, posts, andparticipants in the forum, including a list of the top posters. These statistics help you understandhow users are participating in your discussion forum.Finally, the Banned Users menu option gives you details about users who have beenbanned from participating in the discussion forum. Administrators or users with appropriaterights are allowed to ban any unwanted user; they can later unban that user so the user canresume participation in the discussion forum.You’ll now study these various menu options in depth to understand how to set up, monitor,and administer a discussion forum.
Defining Categories
The first thing you need to do while setting up a discussion forum is create categories and setaccess rights to them. For the securities portal, you’ll initially create two discussion categories:Fundamental Message Bulletin and Technical Message Bulletin. Click the Add Category buttonin the Categories menu option to create these categories. You should see the screen shown in Figure 4-2.

Here, you will enter the category name and its description. To create the Fundamentalcategory, enter Fundamental in the Name box and Fundamental Message Bulletin in theDescription box.Before you save the new category, you might want to set permissions on it. You can assigndifferent permissions depending on the user type. Generally, there are two types of users:community and guest.
You can set the permissions for each type of user in the check boxes on the Categoryscreen (see Figure 4-2). For each category you create, you can enable or restrict a user’s rightsby specifying the actions they are allowed to perform. By default, a community user is grantedpermission to add a file, add a message, reply to a message, subscribe to a discussion, or viewposts. A guest user, on the other hand, only has the right to view posts. (I’ll delve further intopermissions in the “Permissions” section under “Category Actions,” and in the “Permissionson Categories” section after that.)
After assigning the desired rights to the two kinds of users, click the Save button. You’ll seethe screen shown in Figure 4-3 if your request processed successfully.

You can now see the newly added Fundamental category in the list of categories. Likewise,you can add another discussion category called Technical (for the technical analysts); you willsee this second category appear below the Fundamental category in the list.
Category Actions
After adding categories, you might want to perform certain actions on them before makingthem available to the forum users. Click the Actions button that appears on the right side of thecategory name to pull up the following choices:
• Edit
• Permissions
• RSS
• Subscribe
• Delete
Edit:
Under the Edit option, you can modify the name and description of your category. Plus, youcan select the category’s parent category and even merge any category with its parent.
Permissions:
Under this option, you can add roles and permissions. As I mentioned when I discussed thecheck boxes in the Category screen, you can assign certain allowed activities to communityusers and guest users. Such activities include adding messages to the discussion forum, deletingmessages, replying to messages, and so on. A community user, who enjoys more privilegesthan a guest user, can be classified as an administrator, a member, or an owner.A user who creates a community is the owner of that community. The community ownercan appoint a user as the community’s administrator, and assign administrative rights tothat user accordingly. All other users belonging to that community are classified as ordinarymembers.The actions that a user is allowed to perform depend on his or her role in the community.You can control these permissions through the Permissions menu option; when you click it,you will see the screen shown in Figure 4-4.

You’ll see two tabs onscreen: Regular Roles and Community Roles. I’ve already listedthe possible community roles: owner, administrator, and ordinary member. A guest useris classified as a regular role. Other regular roles are ordinary user, power user, owner, andadministrator. For each type of user, you can assign different rights that allow various actionson the created category.Figure 4-4 displays a list of currently assigned permissions under Regular Roles. Note thatour guest user has only the View permission. If you want to change a guest user’s permissions,mark the check box in front of the Guest user listing and click the Update Permissions button.You’ll see the screen shown in Figure 4-5.

The actions that a guest can perform are shown in the list on the left, and the actions aguest cannot perform are shown in the list on the right. Using the two arrow buttons, you canmove these actions into the desired lists. After you complete your changes, click the Finishedbutton to see the assigned actions on the main permissions screen. You can go through thisprocess for the community-role users as well as the regular-role users.
RSS:
Here’s another thing you might want to do to a discussion-forum category before making itavailable on your portal: generate an RSS feed based on posts to that category. An RSS feedproves useful in several situations, especially ones in which the feed is dynamic. The RSS viewof our Honda Motors thread1 in the Automotive Industry category is shown in Figure 4-6, asseen in IE (Internet Explorer).

You can sort the feed output by date, title, or author. You and your users can subscribe tothis feed by clicking the Subscribe to this feed link (see Figure 4-7).

You need to enter the name and the folder for the feed. Once you subscribe to a feed, theportal displays a confirmation message. Clicking the View my feeds hyperlink that appears onthe next screen displays a list of all your subscribed feeds. You can then select any displayedfeed and set its properties by clicking the View feed properties link. The resulting Feed Propertiesscreen is shown in Figure 4-8.

On this screen, you can set the feed’s update frequency. The default schedule is oneupdate per day, but you can modify this setting to receive updates as often as every 15 minutesor as rarely as once a week. (You can even specify that you never want updates.) Modifythe schedule by selecting the Use custom schedule radio button and choosing the desired frequencyfrom the drop-down list. You can also choose to automatically download the attachedfiles by marking the corresponding check box. In the Archive section of the screen, you canrestrict the number of feed entries to be archived if you want to save valuable real estate onyour hard drive. You can keep a maximum of 2,500 items or specify your own limit; the portalwill archive only the most recent entries up to that limit.
Subscribe:
Yet another action you can perform on a discussion-forum category is allowing your usersto subscribe and unsubscribe to it. After users subscribe, they will be notified of posts andchanges made by other members. Members who are already subscribed to a category have theoption of unsubscribing through the Actions button, as the Subscribe menu option automaticallychanges to Unsubscribe as appropriate.
Delete:
Access the Delete option through the Actions button to delete the currently selected discussioncategory. You’ll be asked to confirm before the entry is actually deleted.
Permissions on Categories
As I mentioned in the “Category Actions” section, you can use the Permissions action menu toset the various permissions for different types of users. Now I’ll provide details about the variouspermissions that you can assign or deny to users:
• Add File
• Add Message
• Add Subcategory
• Delete• Move Thread
• Permissions
• Reply to Message
• Subscribe
• Update
• Update Thread Priority
• View
Add File
If you grant the Add File permission to your users, they will be able to attach files while postingmessages or replies (see Figure 4-9).

A user can attach as many as five files to a reply. If the user changes her mind before postingthe reply, she can remove the list of all selected files by clicking the Remove Files button.
Add Message
Posting messages to the forum is allowed only if the user has been granted the Add Messagepermission. Users with only the View permission will not be able to contribute to the forum.
Add Subcategory
I’ll discuss subcategories further in the next section. But for now, suffice it to say that the AddSubcategory permission allows a user to add subcategories under the existing categories. Creating categories and subcategories helps organize discussion threads logically and makes iteasy for users to search, locate, and read only the threads of interest to them.
Delete
With the Delete permission, a user can delete existing categories and subcategories. Over time,some discussion threads will become stale or will have only historical importance. Deletingcategories containing those threads will improve the forum experience for new readers, whomight not be interested in viewing those threads.
Move Thread
The Move Thread permission allows a user to move a discussion thread from one category toanother. This again helps organize threads into logical units. I’ll discuss how to move a threadin the more detailed “Moving Threads” section later in this chapter.
Permissions
The Permissions permission lets a user set the various permissions described in this section.Generally, only the owner and administrators will have this permission because they are theonly ones who should have the ability to grant or deny rights to other users.
Reply to Message
A community user will have the Reply to Message permission granted by default. With it, theuser can reply to any message on the forum. A guest user will not have this permission grantedby default, and thus will only be able to view messages without replying. Generally, you’ll wantto trace who has posted replies on the forum, so you don’t want to grant this permission to aguest user.
Subscribe
With the Subscribe permission, a user can subscribe to the feeds of his choice
Update
The Update permission allows a user to modify a message.
Update Thread Priority
With the Update Thread Priority permission, a user can modify the priority assigned to athread within the current category.
View
With the View permission, a user can view messages posted by all users.
Subcategories
So far you have created two discussion categories: Fundamental and Technical. You will nowlearn to create subcategories under these categories so you can organize your information inlogical units. For this example, you’ll create a subcategory called Automotive Industry underthe Fundamental category. (You were briefly introduced to this subcategory when I discussedRSS feeds earlier in the chapter.) All the discussion threads pertaining to the automobileindustry will appear under this subcategory in the forum. To create a subcategory under Fundamental, click the category in the list displayed onthe Categories screen of the Message Boards application. Your screen will show the full path tothe Fundamental category along with a button to add a subcategory. Click this button to bringup the familiar category-addition screen. Here, you can enter the subcategory’s name anddescription, and also set permissions. After you have finished making changes, click the Savebutton to create the subcategory and add it under the Fundamental category. You can create as many subcategories as you wish to organize all the discussions intological units.
Exploring Threads
A forum thread starts when an authorized user posts a message to initiate a discussion. Usersthen reply to the post, followed by other users, and so on. In this manner, a thread can growquite large. Here’s how to create a thread.
Creating a Thread
You’ll create a thread under our Automotive Industry subcategory to open a discussion aboutthe fundamentals of the corporations in the automotive sector. Click the Post New Thread buttonin the Threads tab to pull up a screen similar to the one shown in Figure 4-10.

Do the following for the various fields:
• Subject: Enter Honda Motors.
• Body: Enter This thread discusses the fundamentals of Honda Motors.
• Anonymous: Leave this unchecked.
• Priority: Select Announcement from the drop-down list.
• Tags: Leave this blank for now.
• Permissions: You can configure permissions as discussed earlier or leave this fielduntouched.
Before saving your changes, you might want to set the look and feel of the body contents.You can set the font, color, text alignment, and so on using the various buttons at the topof the editor. Once you are satisfied with the design, click the Save button. This saves yourchanges and posts your message to the thread. Your newly posted thread should look like theone shown in Figure 4-11.

Actions on Posts:
After you have posted a message to a thread that you started, you can perform various actionson it:
• Edit: This option allows you to modify your post’s subject, body text, priority, tags, andso on. You edit existing posts with the editor you used to create the post.
• Permissions: While creating the category, you set up the permissions for users inregular and community roles. You can edit any of these permissions using this menuoption.
• Delete: This simply allows you to delete the current post (you’ll first be asked toconfirm).
• Reply: This option allows you to post a reply—yes, you can reply to your own message.Sometimes you might want to a post a reply rather than edit the message itself to drawother users’ attention to your changes. When you post a reply, the new reply messageappears under the original message, so that others can see your remarks on the existingmessage. You create the reply message in a screen similar to the one you used to createa new post.• Reply with Quote: This option puts the original message body in quote tags.
All your messages and replies appear in a hierarchy at the top of the screen that displaysthe threads. Using the links in the hierarchy, you can jump to any post to edit it or reply to it. Atypical message hierarchy is shown in Figure 4-12.

Subscribing to a Category or Thread
So far you have learned to create categories and threads. How do you know when somebodyposts a message to a thread? To get an automatic update when new posts are made or existingposts are modified, you need to subscribe to the desired category or thread.
To subscribe to a particular category, perform the following steps:
1. Click the Categories tab and locate the desired category in the displayed list.
2. Click the Actions button.3. In the displayed menu, click the Subscribe option.
You are now subscribed to the currently selected category. The menu changes accordingly,showing an Unsubscribe option instead.To subscribe to a particular thread, follow the steps listed here:
1. Select the appropriate category to which the desired thread belongs.
2. Locate the desired thread in the list of displayed threads for the selected category.
3. Click the Actions button.
4. Click the Subscribe menu option.
You are now subscribed to the currently selected thread. The menu changes accordingly,showing an Unsubscribe option that you can use to terminate your subscription to thecurrent thread.The purpose of subscribing to a category or thread is to receive notifications wheneverchanges or new posts are made. Liferay sends such notifications to all the subscribers throughe‑mail. The notification messages are automatically generated and dispatched. As an administrator,you get an opportunity to set up the format and the text of these notification messages.You will learn to set up these notification messages in the “Configuring Message Boards” sectionlater in this chapter.
Moving Threads
Sometimes you’ll want to reorganize discussion threads by moving them from one categoryto another. To do this, first navigate to the desired category to get a list of its threads (see Figure4-13) and then select the thread that you want to move.

At the top-right corner of the screen, you will notice the Move Thread button. Click thisbutton to get the Category selection screen as shown in Figure 4-14.

Click the Select button to get a list of categories and choose the category where you wantto move your thread. The selected category name appears after the Category label. Click theMove Thread button to complete the move operation. You will see the moved thread under thenew category.
Managing Message Boards
On the Categories screen shown in Figure 4-15, you will notice the Search Messages button.

To the left of the Search Messages button, you’ll see an edit box where you can entersearch terms. When you click the button, the application searches all the messages in theforum for the search terms and displays the results. You can navigate to a particular messagefrom that display.
Now you’ll explore the other menu options in Liferay’s Message Boards application to seehow they help you manage your message boards.
My Posts
When you select the My Posts menu option, you will see a list of all your posts. This list consistsof all the threads you started as well as your posts to threads that other users started.For each thread, the application displays the identity of the thread’s originator, the numberof posts, and the number of views, in addition to the date, time, and author of the mostrecent post. A typical output screen displaying the list of posts for our administrator Anita isshown in Figure 4-16.

You can perform various actions on each displayed thread using the Actions button, whichI discussed toward the beginning of the chapter in the “Category Actions” section. To recap,such actions include editing, setting permissions, subscribing to the thread, viewing it inRSS format, and deleting the thread. The actions available to you depend on the permissionsyou’ve been granted for the selected thread.
My Subscriptions
The My Subscriptions menu option allows you to view all your subscriptions to various categoriesand threads (see Figure 4-17). You can perform actions on your subscriptions using theActions button, just as you did with threads in the My Posts screen.

Recent Posts
The Recent Posts option allows you to view all the recent posts made by various users. It providesinformation on each thread, including the date and author of the last post made to it (seeFigure 4-18).

You can take advantage of the Actions button here as well, and you also get a choice tosubscribe to recent posts through an RSS feed.
Statistics
The Statistics option shows you statistics on the discussion-forum posts. It gives you bothgeneral statistics and statistics about the forum’s top posters. General statistics include theforum’s number of categories, number of posts, and number of participants. This statisticaldata helps you better monitor and manage your forum. Statistics about top posters include thenumber of posts they have made, their joining date, and the date when they last posted to theforum. You might find it useful to know who your most active users are.
Banned Users
You might find occasion to ban a user from your forum. The Banned Users menu optiondisplays information on all the users who are no longer allowed to participate. The screendisplays the user ID of the banned user, the name of the administrator who implemented theban, and the date the ban started (see Figure 4-19). You’ll also notice that the date on which auser can be unbanned is displayed in the list. Liferay will automatically unban the user on thegiven date unless an administrator manually specifies otherwise.

To ban a user, first display a list of posts through the Categories tab or the Recent Posts tab.Then navigate to the post that has violated the rules of your forum. Under the author’s name,you will find a link to ban the user (see Figure 4-20).

Clicking this link will prevent the user from posting to the forum. Also, observe that thelink has changed to Unban this User. Clicking this would unban the user so that she canresume posting to the forum.
Working with Tags
As the number of your forum’s community users increases, searching through their postsmight become strenuous. The use of tags proves handy in such circumstances. You can giveusers the ability to tag their postings with important keywords. You can then search the entireforum for tagged keywords.
Tagging Contents
Tagging the contents is an easy task. When creating a message earlier, you might have noticedthe Tags edit box at the bottom of the message-editor dialog (see Figure 4-21).

Adding Tags
To add new tags, use the following steps:
1. Type the desired tag name in the Tags edit box.
2. As soon as you type one or more characters, you’ll see a list of existing tags that startwith those letters.
3. You can select the tag name from the displayed list or enter a new name.
4. Click the Add Tags button.
5. The tag name will appear above the Tags label.
Tag Suggestions
If you can’t decide on the tag names for the message, Liferay provides help by suggestingsome. To get the suggestions, follow these steps:
1. Click the Suggestions button. A list of names will be displayed onscreen; Liferay getsthese names from the message contents.
2. Mark all the names you want to add to your list using the corresponding check boxes.
3. Click the Save button. This adds all selected tag names to the list of tags.
4. Note that the tags also appear above the Tags label indicating that the current messageis tagged with these keywords.
Removing Tags
Sometimes, you might wish to remove a tag applied to a message. To remove a tag, simplyclick the “x” displayed in front of the tag name. The selected keyword will disappear from thetag list.
Selecting Tags
Follow these steps to tag the current message with a preexisting tag:
1. Click the Select Tags button to pull up a list of existing tags. (I’m assuming you havealready added a few tags.)
2. Select the desired tag for the message. You can select multiple tags.
3. Click the Save button.
4. The selected tag(s) appear above the Tags label
Configuring Message Boards:
In previous chapters, you learned to configure the portlet applications that you added to yourportal pages. Similarly, you can configure the Message Boards application by creating some ofthe application’s default settings. When you click the configuration icon in the Message Boardsapplication, you will see these tabbed options onscreen:
• Email From
• Message Added Email
• Message Updated Email
• Thread Priorities
• User Ranks
• RSS
• Anonymous Postings
• Ratings
Let us now look at these options in depth.
Email From
The Email From option allows you to configure the e‑mail settings of your notification messages.The corresponding tabbed screen is shown in Figure 4-22.

Here, you need to enter the name and e‑mail address of the message sender. Mark theHTML Format check box if you want to format the message in HTML. The screen also displaysthe list of definitions used in your message.
Message Added Email
The Message Added Email option allows you to set the default format for the notification messagethat goes to subscribers when a new message is posted to the forum.You can define the Subject, Body, and Signature for the message. Liferay offers some predefinedterms you can use for these three fields, but you can choose to exclude them from your custom-formatted message. You can also type arbitrary text around the defined terms tofurther customize the message.
Message Updated Email
The Message Updated Email option functions like the Message Added Email option. It allowsyou to set the default format for the notification message that goes to subscribers when anexisting forum message has been updated.
Thread Priorities
The Message Boards application defines three priorities in the Thread Priorities screen: Urgent,Sticky, and Announcement (see Figure 4-23).

Depending on importance, priority levels are set from 1 to 3. Urgent is assigned the highestpriority level (3.0) while Announcement has the lowest priority level (1.0). For each priorityname, a URL for an image is assigned. This image gives users a visual clue regarding the messagepriority.
You are free to redefine these priority levels. For example, you might decide to createmore priority levels ranging from 1 to 5, or even 1 to 10. Edit the displayed boxes to modify thepredefined priority levels and to add new ones. You can also select the localized language ofyour choice from the drop-down list and perform the additional step of translating the text forthe thread-priority levels into that language.Once you are done with your editing, click the Save button to save your changes. You andyour users will then be able to apply these priorities to newly created messages.
User Ranks
It is always a good practice to rank the users who post to your forum. Such ranking is typicallyassigned based on the number of postings made by the user.The Message Boards application provides a set of predefined ranks, which include these:
• Youngling=0
• Padawan=25
• Jedi Knight=100
• Jedi Master=250
Each rank name is listed with the number of postings required to achieve that rank. Forexample, a newbie is assigned the Youngling rank. When a user makes 25 postings to theforum, he achieves the Padawan rank. After 100 postings, the Jedi Knight rank is assigned, andso on. You can modify the rank names as well as the number of required postings to createyour own ranking system. You can also add more ranking levels of your own.In addition to the ranks for community users, Message Boards also supplies several predefinedranks for forum moderators. As you can do with thread priorities, you can select alocalized language and translate the ranking text into this newly selected language.
RSS
In the “Category Actions” section toward the beginning of this chapter, you saw that it waspossible to view forum postings in RSS format. The RSS tabbed menu allows you to set defaultsfor your RSS feed, such as the maximum number of items to display, the display style, and theformat.You can display between 1 and 100 items in your RSS feed by making the appropriateselection from the drop-down list. The numbers initially increment by a factor of 1, then by 5,and finally by 10.For your RSS-feed display style, you have three choices: full content, abstract, and title. Ifyou decide to use a small number as your maximum, you’ll have space to display full contentin the feed. If you use a large number, you might want to display the title only. For in-betweencases, display the abstract.Finally, you have three choices for the feed format: RSS 1.0, RSS 2.0, and Atom 1.0.
Anonymous Postings
The Anonymous Postings option lets you specify whether to allow anonymous postings to yourforum. Enabling anonymous postings will allow users to post messages without signing on tothe forum. If you wish to associate each post with the identity of the post’s author, uncheck thecheck box on this screen.
Ratings
The Ratings option lets you enable or disable message ratings for the forum via a single checkbox.