- $users = q("SELECT profile.*, `user`.`login_date`, `lastitem`.`lastitem_date`
- FROM (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
- FROM `item`
- WHERE `item`.`type` = 'wall'
- GROUP BY `item`.`uid`) AS `lastitem`
- RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`, `contact`, `profile`
- WHERE
- `user`.`uid` = `contact`.`uid` AND `profile`.`uid` = `user`.`uid`
- AND `profile`.`is-default` AND (`profile`.`publish` OR `profile`.`net-publish`)
- AND `user`.`verified` AND `contact`.`self`
- AND NOT `user`.`blocked`
- AND NOT `user`.`account_removed`
- AND NOT `user`.`account_expired`");
-
+ $users = qu("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
+ FROM `user`
+ INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` AND `profile`.`is-default`
+ INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
+ WHERE (`profile`.`publish` OR `profile`.`net-publish`) AND `user`.`verified`
+ AND NOT `user`.`blocked` AND NOT `user`.`account_removed`
+ AND NOT `user`.`account_expired`");