OpenWGA 5.4 - TMLScript reference


Object:

TMLUserProfile

Description This object represents the personalisation profile of the current browser user. This is a document which is automatically created for each browser user and stores any settings that just apply to him.

Its main purpose is to to store items which influence the indiviual application behavior for this user. These profile items have the same characteristics as items on content documents. They can be created and read by the OpenWGA design as needed can hold arbitrary data. Changes to items must be saved for being stored.

Additionally personalisation profiles can automatically collect statistical data about the user, like his number of sessions, his recently used browser etc. These are available as metadata fields of the user profile but it is up to the administrative application configuration in if and which statistics are collected.

There is a shortform syntax for reading items and metadata fields. You can just use the name of the item (in lowercase) or the name of a metadata field (in uppercase) as property of the TMLUserProfile object.

The personalisation profile does also host the registration of WebTML portlets for the current user. These however are not maintained by this object but by object TMLPortlet.

There are different strategies how a personalisation profile is assigned to a browser user, which are also chosen on the administrative configuration. Based on that there are some cases where the current user may not have a profile:
  • If the strategy "login" is configured and the current user is not logged in
  • If the strategy "custom" is configured and no profile has yet been assigned to the user
In these cases the personalisation profile returns null.

All methods of this object are case insensitive and can be used in arbitrary cases though we recommend to use the case specified in this documentation.

Retrieval this.profile
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
    portletevent
Properties and methods
Name Purpose
profile.hasItem(itemname) Tests if an item is available
profile.item(name) Reads the value of a profile item
profile.itemList(name) Returns the value of a profile item as list
profile.meta(name) Reads the value of a metadata field
profile.metaList(name) Returns the value of a metadata field as list
profile.profile Offers the WGAPI object representing the personalisation profile
profile.removeItem(name) Removes an item from the profile
profile.save() Stores all changes to the personalisation profile
profile.setItem(name, value) Creates or updates a profile item
Examples Reading a profile item, once in full, once in shortform syntax:
profile.item("username")
profile.username

The same with a metadata field, in this case "sessions" holding the number of browser sessions of the user:
profile.meta("sessions")
profile.SESSIONS