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.
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
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]]