This page last changed on Jun 18, 2010 by gcheck.

This page describes a way of preventing your user from changing their Profile. In this way, you can ensure that all Profiles are only set from Confluence Admin.

Customisations are not supported
Note that Atlassian support does not cover customisations to Velocity files, such as those described on this page.
All files should be located under <confluence-home>\confluence\users.

Removing the User Password Option.

To remove the option that allows people to select a new password, you will need to edit the Velocity template (.vm file) as described below.

  1. Locate your editmyprofile.vm file under
    <confluence_home>\confluence\users\editmyprofile.vm
  2. Edit this file with your favorite editor, such as Wordpad, Notepad or Notepad++ (recommended). The file looks something like this:

#macro (renderIfEdit $markup)
#trim()
#if ($editMode == true)
$!generalUtil.htmlEncode($markup)
#else
$!statusTextRenderer.render($markup)
#end
#end
#end

#set($viewingMyProfile = $personalInformationEntity.belongsTo($remoteUser))
<html>
<head>
<title>$generalUtil.htmlEncode($pageTitle)</title>
#requireResource("confluence.web.resources:aui-forms")
#requireResource("confluence.userstatus:userstatus-resources")
</head>

#if ($editMode)
#set($mode = "edit-profile-single")
#else
#set($mode = "edit-profile-three")
#end

#applyDecorator("root")
#decoratorParam("context" "profile")
#decoratorParam("mode" $mode)
#decoratorParam("helper" $action.helper)
#decoratorParam("infopanel-width" "200px")

<body>

<div class="profile-info #if(!$editMode)section-3#end">
#applyDecorator("form-aui")
#decoratorParam("formName" "editmyprofileform")
#decoratorParam("submitAction" "$req.contextPath/users/doeditmyprofile.action")
#decoratorParam("editAction" "$req.contextPath/users/editmyprofile.action")
#decoratorParam("editMode" "$editMode")
#if(!$editMode && $viewingMyProfile)<a href="$req.contextPath/users/editmyprofile.action" class="edit-link">$action.getText("edit.name")</a>#end
<h2 class="subheading first">$action.getText("profile.group.personal")</h2>
#form_xsrfToken()

<fieldset>
#if (!$settingsManager.getGlobalSettings().isExternalUserManagement() && !$userAccessor.isReadOnly($user))
#tag( "TextField" "label='fullname.name'" "name='fullName'" "size='50'" "theme='aui'" )
#tag( "TextField" "label='email.name'" "name='email'" "size='50'" "theme='aui'" )
#else
#if($editMode)
<strong class="extra-info">$action.getText('user.fields.readonly')</strong>
#end
#tag( "TextField" "label='fullname.name'" "name='fullName'" "size='50'" "theme='aui'" "readonly=true" )
#tag( "TextField" "label='email.name'" "name='email'" "size='50'" "theme='aui'" "readonly=true" )
#end
#foreach ($key in $action.getUserDetailsKeys("personal"))
#bodytag( "TextField" "label='confluence.user.profile.$key'" "name='userparam-$key'" "value=getUserProperty('$key')" "size='50'" "theme='aui'" )
#param ("renderWiki" $statusTextRenderer)
#end
#end
#if($editMode)
#bodytag ("Component" "name='personalInformation'" "template='textarea.vm'" "theme='aui'")
#param ("label" "$action.getText('personal.info')")
#param ("rows" 8)
#param ("cols" 70)
#param ("renderWiki" $blockWikiStyleRenderer)
#end
#end
</fieldset>

<h2 class="subheading">$action.getText("profile.group.business")</h2>

<fieldset>
#foreach ($key in $action.getUserDetailsKeys("business"))
#bodytag( "TextField" "label='confluence.user.profile.$key'" "name='userparam-$key'" "value=getUserProperty('$key')" "size='50'" "theme='aui'" )
#param ("renderWiki" $statusTextRenderer)
#end
#end

#if($editMode == true)
#parse ("/pages/includes/captcha-form-elements.vm")
#end

#if($viewingMyProfile == true && $editMode==true)
<br/>
#bodytag( "Submit" "theme='aui'" )
#param ("submitValue" "$action.getText('save.name')")
#end
#end
</fieldset>

#end
</div>

#if(!$editMode)
<div class="profile-main section-2">
<div>
#if($action.userStatusPluginEnabled && $action.currentStatus && !$editMode)
<div class="status-block #if($viewingMyProfile) current-user-latest-status#end">
<span class="status-text">$statusTextRenderer.render($action.currentStatus.status)</span>
<div class="status-actions">
<ul>
<li><a id="view-$action.currentStatus.id" href="$req.contextPath$action.currentStatus.urlPath" title="$action.dateFormatter.formatDateTime($action.currentStatus.lastModificationDate)">$action.formatFriendlyDate($action.currentStatus.lastModificationDate)</a></li>
#if ($viewingMyProfile == true)<li><a id="clear-$action.currentStatus.id" href="$req.contextPath$action.currentStatus.clearPath&#url_xsrfToken()">$action.getText("clear.name")</a></li>#end
</ul>
</div>
</div>
#end

#if($hasAboutMe)
<div class="profile-section" id="profile-about-me">
#if(!$editMode && $viewingMyProfile)<a href="$req.contextPath/users/editmyprofile.action" class="edit-link">$action.getText("edit.name")</a>#end
<h2 class="subheading">$action.getText("personal.info")</h2>
<div id="profile-about-me-content">$renderedAboutMe</div>
</div>
#end

<div class="profile-section" id="profile-status-list">
<h2 class="subheading">$action.getText("activity.name")</h2>
$helper.renderConfluenceMacro("

  • No recent updates found.
")
</div>
</div>
</div>

#end

</body>
#end
</html>

  • This Red line above is just the Save and Cancel Button, you cannot remove other tags, or it will disappear from Profile Details.
  1. Let's comment what is shown in Green with <!-- and –>. And let's add a comment saying that the user cannot edit his profile. After the edit, you should have something like this:

#macro (renderIfEdit $markup)
#trim()
#if ($editMode == true)
$!generalUtil.htmlEncode($markup)
#else
$!statusTextRenderer.render($markup)
#end
#end
#end

#set($viewingMyProfile = $personalInformationEntity.belongsTo($remoteUser))
<html>
<head>
<title>$generalUtil.htmlEncode($pageTitle)</title>
#requireResource("confluence.web.resources:aui-forms")
#requireResource("confluence.userstatus:userstatus-resources")
</head>

#if ($editMode)
#set($mode = "edit-profile-single")
#else
#set($mode = "edit-profile-three")
#end

#applyDecorator("root")
#decoratorParam("context" "profile")
#decoratorParam("mode" $mode)
#decoratorParam("helper" $action.helper)
#decoratorParam("infopanel-width" "200px")

<body>

<div class="profile-info #if(!$editMode)section-3#end">
#applyDecorator("form-aui")
#decoratorParam("formName" "editmyprofileform")
#decoratorParam("submitAction" "$req.contextPath/users/doeditmyprofile.action")
#decoratorParam("editAction" "$req.contextPath/users/editmyprofile.action")
#decoratorParam("editMode" "$editMode")
#if(!$editMode && $viewingMyProfile)<a href="$req.contextPath/users/editmyprofile.action" class="edit-link">$action.getText("edit.name")</a>#end
<h2 class="subheading first">$action.getText("profile.group.personal")</h2>
#form_xsrfToken()

<fieldset>
#if (!$settingsManager.getGlobalSettings().isExternalUserManagement() && !$userAccessor.isReadOnly($user))
#tag( "TextField" "label='fullname.name'" "name='fullName'" "size='50'" "theme='aui'" )
#tag( "TextField" "label='email.name'" "name='email'" "size='50'" "theme='aui'" )
#else
#if($editMode)
<strong class="extra-info">$action.getText('user.fields.readonly')</strong>
#end
#tag( "TextField" "label='fullname.name'" "name='fullName'" "size='50'" "theme='aui'" "readonly=true" )
#tag( "TextField" "label='email.name'" "name='email'" "size='50'" "theme='aui'" "readonly=true" )
#end
#foreach ($key in $action.getUserDetailsKeys("personal"))
#bodytag( "TextField" "label='confluence.user.profile.$key'" "name='userparam-$key'" "value=getUserProperty('$key')" "size='50'" "theme='aui'" )
#param ("renderWiki" $statusTextRenderer)
#end
#end
#if($editMode)
#bodytag ("Component" "name='personalInformation'" "template='textarea.vm'" "theme='aui'")
#param ("label" "$action.getText('personal.info')")
#param ("rows" 8)
#param ("cols" 70)
#param ("renderWiki" $blockWikiStyleRenderer)
#end
#end
</fieldset>

<h2 class="subheading">$action.getText("profile.group.business")</h2>

<fieldset>
#foreach ($key in $action.getUserDetailsKeys("business"))
#bodytag( "TextField" "label='confluence.user.profile.$key'" "name='userparam-$key'" "value=getUserProperty('$key')" "size='50'" "theme='aui'" )
#param ("renderWiki" $statusTextRenderer)
#end
#end

#if($editMode == true)
#parse ("/pages/includes/captcha-form-elements.vm")
#end

<!--
#if($viewingMyProfile == true && $editMode==true)
<br/>
#bodytag( "Submit" "theme='aui'" )
#param ("submitValue" "$action.getText('save.name')")
#end
#end
-->
<p><font size="3" color="red">You cannot change your Profile, this is disabled.<br>
If you need to change anything contact the Admin.<br></font></p>
</fieldset>

#end
</div>

#if(!$editMode)
<div class="profile-main section-2">
<div>
#if($action.userStatusPluginEnabled && $action.currentStatus && !$editMode)
<div class="status-block #if($viewingMyProfile) current-user-latest-status#end">
<span class="status-text">$statusTextRenderer.render($action.currentStatus.status)</span>
<div class="status-actions">
<ul>
<li><a id="view-$action.currentStatus.id" href="$req.contextPath$action.currentStatus.urlPath" title="$action.dateFormatter.formatDateTime($action.currentStatus.lastModificationDate)">$action.formatFriendlyDate($action.currentStatus.lastModificationDate)</a></li>
#if ($viewingMyProfile == true)<li><a id="clear-$action.currentStatus.id" href="$req.contextPath$action.currentStatus.clearPath&#url_xsrfToken()">$action.getText("clear.name")</a></li>#end
</ul>
</div>
</div>
#end

#if($hasAboutMe)
<div class="profile-section" id="profile-about-me">
#if(!$editMode && $viewingMyProfile)<a href="$req.contextPath/users/editmyprofile.action" class="edit-link">$action.getText("edit.name")</a>#end
<h2 class="subheading">$action.getText("personal.info")</h2>
<div id="profile-about-me-content">$renderedAboutMe</div>
</div>
#end

<div class="profile-section" id="profile-status-list">
<h2 class="subheading">$action.getText("activity.name")</h2>
$helper.renderConfluenceMacro("

  • No recent updates found.
")
</div>
</div>
</div>

#end

</body>
#end
</html>

  1. Save the file. You can reload your page and see the changes. There is no need to restart Confluence.

After following the above steps, you will have something like this:

And Something like this too:

Congratulations, that's it
Have a drink!

editprofile1.jpg (image/jpeg)
editprofile2.jpg (image/jpeg)
Document generated by Confluence on Mar 16, 2011 18:50