×

You're using an outdated browser

For a better experience, keep your browser up to date. Check here for the latest version.

Manual

Displaying Additional User Information from the User Profile Plugin

Thomas Walker

Thomas Walker Last update: Oct 16, 2017

The User Profile Plugin lets you add additional information to user profiles. This recipe explains how to display user information from the User Profile Plugin.

Info

This recipe works with User Profile Plugin versions 1.10 and higher.

Displaying Extended User Details on a Page

In a page template, use the following information to output user details:

$upp.getProperty($page.author, "Department")  --> Outputs the built-in "Department" property
$upp.getProperty($page.author, "Hobbies")  --> Outputs the custom "Hobbies" property

Info

When a statement in Velocity returns null, Velocity will output the statement itself. For example, if $searchResult.getProperty("Department") is not set (is null), the template will output $searchResult.getProperty("Department").

If you want to output "" (empty string) instead, you can specify the statement as $!statement. In the example, when the statement is changed to $!searchResult.getProperty("Department") (not the additional bang) and the property is not set, the template will output "" (empty string).

Displaying Extended User Details in the Search Results

Create a template file search-user.vm in the top level of the theme directory (read more about user search in the User Search Recipe):

search-user.vm

#foreach($searchResult in $searchResults.results)
    <li>
        <h3>$searchResult.displayTitle</h3>
        <p>Custom Property: $upp.getProperty($searchResult.object, "Custom Property")</p>
    <li>
#end
2x2.12
We use cookies to create a secure and effective browsing experience for our website visitors and to understand how you use our site (i.e. Google Analytics). For more information: click here.
Ok