Issues with User Profile Application upon upgrade

Hello,

We’ve added some customizations to the User Profile Application to change what appears depending on the level of rights a user has. This has included editing the user profile vertical menu to customize or remove specific fields by adding conditions in the parameters (e.g., isActive=#if($hasAdmin)true#{else}false#end) or in the velocity script.

For the XWikiUserPreferencesSheet, we added conditions so general users would not see the options to change their user type, view hidden pages, or adjust extension conflicts.

Admin user preferences menu:
Admin user preferences

General user preferences menu:
General user preferences

We did this by adding the $hasAdmin condition to the desired parts of the code:

Example

    **#if ($hasAdmin)**
    #displayField('displayHiddenDocuments', 'platform.core.profile.displayHiddenDocuments', '0')
    **#end**
    #displayField('accessibility'         , 'platform.core.profile.enableAccessibility'   , '0')
  </dl>

Unfortunately, every time we upgrade (we’re now on 15.10.4), the code breaks and we get the following ‘Failed to execute velocity macro’ error message:

Failed to execute velocity macro error message

Looking at the code, it seems that the #end statement is not getting transferred. I am curious if there is something wrong with how we’ve added the condition that is producing this error?

Thanks!

1 Like