Flagging Inappropriate Asset Content

The asset framework supports a system for flagging inappropriate content in apps. The steps here show you how to enable it in your app.

Figure 1: Users can flag objectionable content.

Figure 1: Users can flag objectionable content.

Follow these steps to enable content flagging in your app:

  1. Make sure your entity is asset enabled.

  2. Choose a read-only view of the entity you want to enable flags on. You can display flags in one of your app’s views, or if you’ve implemented asset rendering you can display it in the full content view in the Asset Publisher app.

  3. In your JSP, include the liferay-flags taglib declaration:

    <%@ taglib prefix="liferay-flags" uri="http://liferay.com/tld/flags" %>
    
  4. Use ParamUtil to get the entity’s ID from the render request. Then use your -LocalServiceUtil class to create an entity object:

    <%
    long entryId = ParamUtil.getLong(renderRequest, "entryId");
    entry = EntryLocalServiceUtil.getEntry(entryId);
    %>
    
  5. Use the liferay-flags:flags tag to add the flags component:

    <liferay-flags:flags
    	className="<%= Entry.class.getName() %>"
    	classPK="<%= entry.getEntryId() %>"
    	contentTitle="<%= title %>"
    	message="flag-this-content"
    	reportedUserId="<%= reportedUserId %>"
    />
    

    The reportedUserId attribute specifies the ID of the user who flagged the asset.

Rating Assets

Social API

Asset Framework

« Customizing Rating Value TransformationIntroduction to Configurable Applications »
Was this article helpful?
0 out of 0 found this helpful