diff --git a/include/api.php b/include/api.php index 5e80e0f0a3..cfbf7a7e5c 100644 --- a/include/api.php +++ b/include/api.php @@ -619,19 +619,32 @@ function api_status_show(&$a, $type){ $user_info = api_get_user($a); // get last public wall message - $lastwall = q("SELECT `item`.*, `i`.`contact-id` as `reply_uid`, `i`.`nick` as `reply_author` - FROM `item`, `contact`, - (SELECT `item`.`id`, `item`.`contact-id`, `contact`.`nick` FROM `item`,`contact` WHERE `contact`.`id`=`item`.`contact-id`) as `i` + + $lastwall = q("SELECT `item`.*, `i`.`contact-id` as `reply_uid`, `c`.`nick` as `reply_author` + FROM `item`, `contact`, `item` as `i`, `contact` as `c` WHERE `item`.`contact-id` = %d AND `i`.`id` = `item`.`parent` - AND `contact`.`id`=`item`.`contact-id` AND `contact`.`self`=1 - AND `type`!='activity' + AND `contact`.`id`=`item`.`contact-id` AND `c`.`id`=`i`.`contact-id` AND `contact`.`self`=1 + AND `item`.`type`!='activity' AND `item`.`allow_cid`='' AND `item`.`allow_gid`='' AND `item`.`deny_cid`='' AND `item`.`deny_gid`='' - ORDER BY `created` DESC + ORDER BY `item`.`created` DESC LIMIT 1", intval($user_info['id']) ); +// $lastwall = q("SELECT `item`.*, `i`.`contact-id` as `reply_uid`, `i`.`nick` as `reply_author` +// FROM `item`, `contact`, +// (SELECT `item`.`id`, `item`.`contact-id`, `contact`.`nick` FROM `item`,`contact` WHERE `contact`.`id`=`item`.`contact-id`) as `i` +// WHERE `item`.`contact-id` = %d +// AND `i`.`id` = `item`.`parent` +// AND `contact`.`id`=`item`.`contact-id` AND `contact`.`self`=1 +// AND `type`!='activity' +// AND `item`.`allow_cid`='' AND `item`.`allow_gid`='' AND `item`.`deny_cid`='' AND `item`.`deny_gid`='' +// ORDER BY `created` DESC +// LIMIT 1", +// intval($user_info['id']) +// ); + if (count($lastwall)>0){ $lastwall = $lastwall[0]; diff --git a/mod/community.php b/mod/community.php index 1f8adf8907..dbf4c82beb 100644 --- a/mod/community.php +++ b/mod/community.php @@ -70,7 +70,7 @@ function community_content(&$a, $update = 0) { `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`, `user`.`nickname`, `user`.`hidewall` - FROM `item` FORCE INDEX (`received`) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` + FROM `item` FORCE INDEX (`received`, `wall`) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' diff --git a/mod/profile.php b/mod/profile.php index c5f787a4f0..c5da0ebed3 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -277,7 +277,7 @@ function profile_content(&$a, $update = 0) { $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid` - FROM `item` FORCE INDEX (created) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` + FROM `item` FORCE INDEX (created, uid) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1