We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40362
    • 5 Posts
    Hi,
    This might very well be an easy problem for you pro:s to solve but I have hit my wall here.

    I want to get a collection of users based on this sql query
    SELECT id FROM `modx_user_attributes` 
    WHERE (`extended` LIKE '%testfield%')


    If I run the query in mySQL it gives me the id of 10 users out of 11750 how would one get this done in a nice way.

    Cheers
      • 40362
      • 5 Posts
      Just to let anyone else is trying to do sorting / searches on extended fields (Yes I know I should make my own extended DB Table but this site is not my baby..... I got it in my lap and have many other things to fix first)

      $c = $modx->newQuery('modUserProfile');
      $c->where(array(
          'extended:LIKE' => '%' . $company . '%',
          'AND:extended:LIKE' => '%' . $showdate . '%',
          //'fullname:LIKE' => 'A%',
      ));
      
      $count = $modx->getCount('modUserProfile',$c);
      echo 'UserProfile count: ' . $count . '</br>';
      
      $profiles = $modx->getCollection('modUserProfile',$c);
      



      Cheers smiley