We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37686
    • 94 Posts
    In my user_attributes table, if have the extended field in which i store the name of instruments

    this is an example of the data in an extended field for a particular user:

    {"email:required:email":"info@***.nl","profiel-info":"","instrument":"Orgel",
    "instrument2":"Piano","login-updprof-btn":"Update Profile","picture":{"name":"","type":"",
    "tmp_name":"","error":"4","size":"0"},
    "upload":{"name":[""],"type":[""],"tmp_name":[""],"error":[4],"size":[0]}}



    My next step is to show all the users based on its instrument.
    So i have an icon of a piano.. and when this icon is clicked on all users with this instrument will be displayed..


    How can i arange this?

      • 37686
      • 94 Posts
      i think typo3 is better wink
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Typo3 is a different beast wink I wont say either one is better than the other, but different systems have different ways of doing things tongue What would be the answer to your question with Typo3?


        As for MODX..

        While you can use extended fields like that, it's not currently set up to allow easy filtering in the way you want it. It's merely a simple way to add extra information. I could come up with a hack-ish way to retrieve it... not sure if I'd recommend using it this way tho tongue

        $c = $modx->newQuery('modUser');
        $c->innerJoin('modUserProfile', 'Profile');
        $c->where(array(
          'Profile.extended:LIKE' => '%instrument":"' . $search .'"%',
        ));
        $c->select($modx->getSelectColumns('modUser','modUser'));
        $c->select($modx->getSelectColumns('modUserProfile','Profile','profile_'));
        
        foreach ($modx->getIterator('modUser', $c) as $user) {
          $u = $user->toArray('', false, true);
          var_dump($u);
        }


        It might be better to consider storing data like that in a custom table. http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 42146
          • 73 Posts
          I'm looking to do about the same thing. be able to search out specific users, and display their profile based on what wanted variable is selected from the extended profile data. IE search by gender, or city, i have about 30 different extended fields. Id like the user to be able to select multiple fields to select, and it searches the user profiles and pulls out and displays those that match.

          if there isn't a efficient way to search and display this data, if best to just store all user data in a custom table. i'll try to figure that out. just seems over my head as far as my php and mysql skills are concerned....

          i was thinking of using advanced search. [ed. note: jstump last edited this post 13 years, 10 months ago.]
            • 18373 ☆ A M B ☆
            • 3,141 Posts
            Yes I'd definitely say custom tables if you will be searching through so many fields. You can index certain key fields that will be searched on commonly to boost performance.
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 37686
              • 94 Posts
              Quote from: markh at Dec 17, 2012, 05:22 PM
              Typo3 is a different beast wink I wont say either one is better than the other, but different systems have different ways of doing things tongue What would be the answer to your question with Typo3?


              As for MODX..

              While you can use extended fields like that, it's not currently set up to allow easy filtering in the way you want it. It's merely a simple way to add extra information. I could come up with a hack-ish way to retrieve it... not sure if I'd recommend using it this way tho tongue

              $c = $modx->newQuery('modUser');
              $c->innerJoin('modUserProfile', 'Profile');
              $c->where(array(
                'Profile.extended:LIKE' => '%instrument":"' . $search .'"%',
              ));
              $c->select($modx->getSelectColumns('modUser','modUser'));
              $c->select($modx->getSelectColumns('modUserProfile','Profile','profile_'));
              
              foreach ($modx->getIterator('modUser', $c) as $user) {
                $u = $user->toArray('', false, true);
                var_dump($u);
              }


              It might be better to consider storing data like that in a custom table. http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components

              very thanks for your responds.
              Typo3 has the ability to build your own extension on a smooth way.. typo3 is more complex, but i have still more experience (i think) with modx smiley