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

    i need sortby for modx_user_messages but it's just inneffective :
    $base_path = $blablabla
    
        if(!$modx->addPackage('blablabla',$base_path.'model/','mv_'))             return $modx->sendForward( 1 );
    
        $mq=$modx->newquery('modUserMessage');
    
        $mq->leftJoin('modUserProfile','Profile','Profile.internalkey=modUserMessage.sender');
        
        $mq->where(array('modUserMessage.recipient'=>$usrId));
    
        $mq->select(array('modUserMessage.*','Profile.fullname'));
        $mq->sortby('modUserMessage.id','ASC');
    
        $mails = $modx->getIterator('modUserMessage',$mq);
    


    The sorted field ( id ) is an INT, the package is included, the db prefix is defined in the package inclusion whats wrong then?
      • 3749
      • 24,544 Posts
      Sortby wants a string with the name of the field to sort on.



      ---------------------------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
      MODx info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 3548
        • 102 Posts
        Can you verify that everything else works as expected, except for sort?
          Antonio Zdilar
          linearvector.com
          • 3548
          • 102 Posts
          Your code is OK, everything works as expected on MODX Revo 2.2.0.
            Antonio Zdilar
            linearvector.com
            • 37929
            • 18 Posts
            ok surely it's my fault... i 'll do further investigations

            edit : this is modx 2.2.0 advanced, and yes evertyhing else works fine. [ed. note: tulavu last edited this post 14 years, 8 months ago.]