I've successfully added a custom field to the User Sign-up page (create_account.jsp) by creating an expando column via Hook plugin. However, the field is not visible until I enable Guest permissions on it through the admin UI.
I need to be able to do this programmatically, through the Hook plugin. Exhaustive research leads me to believe that the following code should do the trick:
Role guest = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
ResourcePermissionLocalServiceUtil.setResourcePermissions(
companyId,
ExpandoColumn.class.getName(),
ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(expandoColumn.getColumnId()),
guest.getRoleId(),
new String[] { ActionKeys.VIEW, ActionKeys.UPDATE });
But it doesn't.
Anyone got any ideas?