MODX Cloud

The Most Productive MODX Learning Playground Ever

Claim Free Lab Account

Login.Profile

Skip to end of metadata
Go to start of metadata


What is Profile?

Profile sets all the current User's (or a specified User's) Profile fields as placeholders, allowing you to display User Profile information on a page.

Usage

Simply add this Snippet to whatever page you want to set the User's Profile fields as placeholders on:

[[!Profile]]

And then display them with placeholders like such:

<p>Username: [[+username]]</p>
<p>Email: [[+email]]</p>
<p>State: [[+state]]</p>
The password fields are never set as placeholders, and are never accessible, for security reasons.

Profile Properties

Profile comes with some default properties you can override. They are:

Name Description Default
prefix A string to prefix all placeholders for fields that will be set by this Snippet.  
user Optional. Either a user ID or username. If set, will use this user rather than the currently logged in one.  
useExtended If true, will set as placeholders all extended fields as well. 1

Example

Display the currently logged in user's email and username.

[[!Profile]]

<p>Username: [[+username]]</p>
<p>Email: [[+email]]</p>

Grab the profile for the user 'marksmith', and add a prefix to the placeholders of 'user.':

[[!Profile? &user=`marksmith` &prefix=`user.`]]

<p>Username: [[+user.username]]</p>
<p>Email: [[+user.email]]</p>

Display the currently logged in username's favorite color (an extended field), with the prefix of 'usr.':

[[!Profile? &prefix=`usr.`]]

<p>[[+usr.username]]'s favorite color is [[+usr.color]]</p>

See Also

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.