Reputation: 280
I have a requirement that once user logged in,there will be a page and custom portlet where user can see all the tags assigned to you and user has to edit, modify , add & save the tags.I googled it and tried some of the ways but i didn't get any idea.if anybody knows please guide me to do this.
This functionality already there in User-> My Account ->Categorization. By using below tag we can have a feature to add tags
<liferay-ui:asset-tags-selector />
But at the same time already tags are there in DB by bulk upload. I need to show those tags as pre-populated by using this tag.Then automatically it gives solution for my requirement.
Upvotes: 1
Views: 119
Reputation: 280
We can do the above requirement by simple three tags as follows.i.e power of liferay.Very awesome!!!
JSP:
<aui:form action="<%=updateTagsURL%>" method="post"
name="updateTagsForm">
<aui:model-context bean="<%=user%>" model="<%=User.class%>" />
<h3>
<liferay-ui:message key="tags" />
</h3>
<aui:fieldset>
<aui:input name="" type="assetTags" label="" />
</aui:fieldset>
<aui:input type="Submit" name="" value="Submit" lable=""></aui:input>
</aui:form>
Action Class:
public void addTags(ThemeDisplay themeDisplay,String emailAddress,String[] tagNames){
User user;
try {
user = UserLocalServiceUtil.getUserByEmailAddress(themeDisplay.getCompanyId(), emailAddress);
AssetEntryLocalServiceUtil.updateEntry(user.getUserId(), themeDisplay.getScopeGroupId(),"com.liferay.portal.model.User", user.getUserId(),null, tagNames);
} catch (PortalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Upvotes: 1