We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24796
    • 3 Posts
    Hi all,

    So here’s the problem. I have an extended attribute for my users called ’address’ and want to be able to show the value on their profile page. So for regular attribute you can just use the placeholder [+user.attribute+] where attribute represents a field in the table modx_web_users_attributes. But when I try to do something like [+user.address+], where ’address’ is in the web_user_attributes_extended table, it doesn’t show the value. Is there a special syntax for extended attributes?

    Thanks in advance!
      • 24796
      • 3 Posts
      So I’ve made some progress. There’s some problem with the query they use to obtain user data. To obtain the user data from the various tables they use the following query (this can be found approximately on line 1826):

      $extraFields = $modx->db->query("SELECT * FROM ".$this->CustomTable.", ".$web_user_attributes." WHERE ".$web_user_attributes.".`internalKey` = '".$modx->getLoginUserID()."' AND ".$this->CustomTable.".`internalKey` = '".$modx->getLoginUserID()."'");


      Notice that they don’t use a JOIN. I have one extended attribute called address. The query result from the above query included an element in the result array called ’address’ but it had no value.

      When I changed the query to this:

      $extraFields = $modx->db->query('select * from modx_web_user_attributes inner join modx_web_user_attributes_extended on modx_web_user_attributes.internalKey = modx_web_user_attributes_extended.internalKey WHERE modx_web_user_attributes.internalKey = 12');


      It included the address field from the custom table (in this case the custom table is the default modx_web_user_attributes_extended) with the correct value. I don’t know if this is a problem with the $modx->db class or with the way php handles the type of query they use.
        • 24796
        • 3 Posts
        My apologies, I had my database messed up. The queries they have work just fine. I hate when that happens!!!