Login Pakage Extended Fields not Populating on Profile

I’m using the Login package to create a front end user login, and using ClassExtender for extra user fields. The extra fields are present in the backend and in the database but they are not populating the place holders for the profile page which they are supposed to do on default.

[[!Profile? &useExtended=`1`]]

<div class="col-md-8 offset-md-1">
        <h4>Extended Field</h4>
       <p>[[+extendedField]]</p>
</div>

and all the names and title through out the site match.

Would really appreciate some help.

MODx 2.7.2
all packages up to date

1 Like

Hello, extended fields are not classextender fields. Pls follow the docs of classextender to show those fields from the CE db on the page.

The extended profile is within Modx, not part of an extra.

You can see the extended fields for a user by clicking (in manager) on the user and looking at their data. I believe stuff like phone number and location are extended fields, but its been awhile since I dealt with that stuff.

But if you have data in Class Extender then you will need to use a call to CE…HTH

1 Like

Login’s Profile snippet should work as your example shows. If not, the following snippet (untested) should also do it:

<?php
/**
 * Snippet name: User
 * 
 * usage:
 * 
 * [[!User]]
 * [[+user.email]] [[+user.extendedField]] [[+user.fullname]] ...
 * 
 */

// set the user id. Defaults to the currently logged in one.
$userId = $modx->getOption('userId', $scriptProperties, $modx->user->get('id'));
if (empty($userId)) { 
    return '';
};

// get the user by user id
$user = $modx->getObject('modUser', $userId);
if (!$user) {
    return '';
}

// get extended fields stored in the modUserProfile object
$profile = $user->getOne('Profile');

if (!$profile) {
    return '';
};

// copy basic and extended user fields to an array 
$userArray = array_merge($user->toArray(), $profile->toArray());

// set placeholders
$modx->toPlaceholders($userArray, 'user');

return '';

After calling the snippet, you can display all basic and extended user fields like this:
[[+user.fieldName]] [[+user.extendFieldName]]

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.