Sometimes you want to make parts of your form available for a certain logged in user or the opposite you want to hide some parts of your form for a special user.
In my case I want to test if a certain person field equals the current logged in user and if it is true I want to display some extra stuff.
There are only 3 Steps left to achieve your goal:
Add two lines under <xsl:param name=”dvt_apos”><xsl:param name=”UserID” />
- Add two lines to your ParameterBinding<ParameterBinding Name=”UserID” Location=”CAMLVariable” DefaultValue=”CurrentUserName”/>
<ParameterBinding Name=”LogonUser” Location = “ServerVariable(LOGON_USER)” />
Now use some code to decide if current user is equal to a certain person field and do some stuff. Change @MyPersonField to your needs.
<xsl:when test=”contains(@MyPersonField, $UserID)”>
Display Current Logon User ID: <xsl:value-of select=”$LogonUser”></xsl:value-of>
Display Current Logon User Name: <xsl:value-of select=”$UserID”></xsl:value-of>
… do other stuff …
..:: I like SharePoint ::..The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.
Dennis de Vries
Loving SharePoint, Social Media and like to work together with creative people all over the world.