Assign user to one ressource - Front -end edition

About my code above. Notice the very first line:

/* Assuming that you have the $user object */

$profile = $user->getOne('Profile');

If you don’t already have the user object, you have to get it before calling getOne().

In the front end, that would be either this at the top:

$user = $modx->user;

or just changing the code to:

$profile = $modx->user->getOne('Profile');
1 Like