Custom user profile fields not saving after registration in MODX Revolution 3.0.3

Hi everyone,

I’m currently building a Geometrrydashapk web application with MODX Revolution 3.0.3. The project includes user accounts, game guides, downloadable content, and player profiles.

I’m extending the user profile to store a few extra values for each member, such as:

  • Favorite difficulty

  • Country

  • In-game username

For this, I created the additional fields in the user profile (extended attributes) and I’m using a custom OnUserFormSave plugin to save the submitted values.

The form loads correctly and all custom fields are displayed without any issues. However, after submitting the form, MODX throws the following error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'favorite_difficulty' in 'field list'

The relevant part of my plugin looks like this:

if ($mode == 'upd' || $mode == 'new') {

    $modx->setUserAttribute('favorite_difficulty', $_POST['favorite_difficulty']);
    $modx->setUserAttribute('country', $_POST['country']);
    $modx->setUserAttribute('gd_username', $_POST['gd_username']);

    return true;
}

Things I’ve already checked:

  • The plugin is firing correctly.

  • The form field names match the submitted POST values.

  • The values are reaching the plugin (confirmed with the MODX error log).

  • Cache has been cleared several times.

  • The user profile updates normally if I only save the default MODX profile fields.

At this point I’m wondering if I’m misunderstanding how extended user attributes are supposed to be saved. Should these values be stored as JSON in the extended field instead of trying to save them as individual attributes?

Has anyone implemented custom profile fields like this in MODX Revolution? If so, what’s the recommended approach?

I’ve attached screenshots of the plugin code and the error log in case they help identify what I’m overlooking.

Thanks in advance for any guidance!

I’m a bit confused. I cant find a function called setUserAttribute in the MODX source code.
It this a custom function? Or a function from a MODX extra? Or did you just use an AI tool that hallucinates?


Yes, this is usually the way it’s done. (See also this blog post from Bob).
Unless you are using an extra like ExtraFields that changes the database table.