Use the Communardo User Profiles app with the Enterprise Theme News Macros
Introduction
User Profiles for Confluence allows you to enhance Confluence user profiles.
With the add-on, you can:
Add fields of various field types to your Confluence user profiles
Synchronize profile fields and user pictures from configured LDAP repositories
Easily filter user profiles in the Confluence People Directory
Display user profiles on Confluence pages using the available macros
Why would I use this app in combination with the Enterprise Theme?
The big use case is user-specific news. Corporate communication can be challenging if you have a big Confluence instance with multiple departments or countries. You might want to solve requirements like these:
How can I make sure that a user is receiving only news relevant to them?
How can I provide a filter for the news - depending on where a user is from?
How can I get users only to see their department-specific news and their country-specific news?
All this can be solved if you combine the Enterprise Theme with the User Profiles Add-on. And you can build even more flexible solutions by combining it with the optional Metadata add-on.
How to use Metadata Information in the Enterprise Theme macros
All Enterprise Theme News macros provide an input field for a Lucene Query parameter. With this parameter you are able to enter every lucene query you like. A detailed documentation about this parameter can be found under Lucene query parameter of the news macros.
The Communardo User Profiles Add-on extends the search index with every user profile element you create in that add-on.
To use the User Profiles elements in the Enterprise Theme news macros, you need to follow these steps:
Combine the name and a static prefix to create a placeholder. This placeholder represents the user specific dynamic value.
Use the name to build a valid Lucene query.
Add this query to the news macro parameter Additional Lucene Query (The Lucene query parameter of the news macros).
Determining the Name of a User Profiles Element
The name of a user Profiles element is the englisch default title you entered during creating the Field. To get this name, you can access the User Profiles configuration via the menu item User Profiles for Confluence > Profile Elements in the panel on the left side of the administration console (choose Cog icon > General configuration at the top right of the screen).
![](../__attachments/12336794334/image2016-11-22%2016:43:10.png?inst-v=ac9b5293-2833-46d1-b363-44b92ea1bd93)
Image 1: Configuration – Profile Element Overview (click to enlarge)
If you click on edit or you create a new field you are able to see or define the default title for this field.
![](../__attachments/12336794334/image2016-11-22%2016:48:34.png?inst-v=ac9b5293-2833-46d1-b363-44b92ea1bd93)
Image 3: Editing Profile Element (click to enlarge)
Create the placeholder for the query
The placeholder for the lucene query parameter of the news macros is created by this syntax:
upc.currentUser.<FieldName>
For example: for the field Location
, your resulting placeholder will be upc.currentUser.Location
.
Whitespaces in your fieldname will be replaced with an underscore (_) .
Please take a look into the following examples:
Examples of Syntax of Lucene Query
If you have found the name of the User Profile Element, you could create a placeholder for the user-specific dynamic value.
Basic search terms with Lucene search syntax are explained at the beginning of this section. Find more complex examples below.
1) Show the content of all pages where the location of the user is set as a label
// Lucene Query
labelText:upc.currentUser.Location
2) If there is a field with all important labels for the specific user, you can filter the news accordingly
// Lucene Query
labelText:upc.currentUser.ImportantLabels
Advanced Usage
3) Filter by the User Profile
The Enterprise Theme allows you to combine more in our content macros 🙂 If you use the Metadata add-on by Communardo you can combine the Metadata Information of the content with the profile information of the current user. This allows you to provide a very user specific content listing in the Enterprise Theme Macro.
// Lucene Query
metadatafield.city:upc.currentUser.Location
The field metadatafield.city
is created by the Metadata add-on in the search index. How you can create such queries and how you retrieve this field names can be read in the "Use the Communardo Metadata Add-on with the Enterprise Theme News Macros" documentation and in the macro documentation of the Top Stories Slider, Blog Posts & Pages and News Boxes macros.