Accessing Information from User Profiles

You can access all user profiles using WebvantaScript, just like accessing any other information in the database.

If you want to list all the member details on public pages of your site, you can; it is up to you to ensure that you put access restrictions on any pages with private information.

The User Profile item type's name for scripting purposes is “webvanta_user_profile”. For example, this code will list all the user profiles and their basic fields, creating a simple member directory:

<ul>

<w:kb:item:each type='webvanta_user_profile' allow_webvanta_user_profile="true">

  <li>

    <p>Name: <w:name /></p>

    <p>e-mail: <w:email /></p>

    <p>Roles: <w:role /></p>

    <p>Activated: 

      <w:if condition='activated=true'>Yes</w:if>

    </p>Admin:

    <w:if condition="role=~admin">

      <b>Yes</b>

    </w:if>

  </li>

</w:kb:item:each>

</ul>

Note that checking the user’s role is a little tricky. In the if statement, the regex operator “=~” pattern matches a value, in this case looking for the string “admin”. A regex is needed because users may have more than one role, and the role tag returns a comma-separated list of such roles.

Any custom fields are accessed simply by name, just as with any custom item type.