Search code examples
liferay-7.1

Is <liferay-ui:custom-attribute/> still recognized in Liferay portal 7.1.0 ga2?


Trying to display the below custom field on create_account.jsp in Liferay Portal 7.1.0 GA2. The permission for a guest user to view and update is already set to the custom field but it is not displaying.

<liferay-ui:custom-attribute
className="<%= User.class.getName() %>"
classPK="<%= 0 %>"
    editable="<%= true %>"
    label="<%= false %>"
    name="address2">

<liferay-ui:custom-attribute/>

Solution

  • Edit:

    The Breaking Changes for Liferay 7.0 document that the tag has moved to the liferay-expando taglib. Just follow that breaking change and use the new taglib instead of the old.

    Longer, prior answer hinting at the above:

    If the tag is still in there, it should. However, granting guest users the permission to update users is a great way to create a loophole and a security issue.

    You might want to

    • Try non-editable display of the data first
    • Check the HTML source, if it contains <liferay-ui:custom-attribute ... - because if it does, either the tag is not supported or you're not importing the required taglib. Unfortunately JSP tags don't always fail gracefully, they'll just render as they are and the browser won't show anything.
    • Looking at Liferay's source, particularly ./modules/apps/users-admin/users-admin-web/src/main/resources/META-INF/resources/user/custom_fields.jsp, it uses <liferay-expando:custom-attribute-list> which is indeed a hint that you might want to look at a different taglibrary.