From 51447932f707e1d0177ee4700266285ed80be2f6 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 24 Mar 2011 01:16:14 -0700 Subject: link same as visited --- mod/profile.php | 1 - 1 file changed, 1 deletion(-) (limited to 'mod/profile.php') diff --git a/mod/profile.php b/mod/profile.php index 4b5f92a1f..d33c9aeb2 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -437,6 +437,5 @@ function profile_content(&$a, $update = 0) { $o .= paginate($a); $o .= '
' . t('Shared content is covered by the Creative Commons Attribution 3.0 license.') . '
'; - return $o; } -- cgit v1.2.3 From c962f5c4bcc26fa7bad98a714cdb5e92b6acb57c Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 27 Mar 2011 19:53:36 -0700 Subject: comment collapsing, pagination wasn't advancing past 16 --- mod/profile.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 8 deletions(-) (limited to 'mod/profile.php') diff --git a/mod/profile.php b/mod/profile.php index d33c9aeb2..9544512ba 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -243,31 +243,52 @@ function profile_content(&$a, $update = 0) { FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `wall` = 1 ) + AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra ", intval($a->profile['profile_uid']) ); - if(count($r)) + if(count($r)) { $a->set_pager_total($r[0]['total']); + $a->set_pager_itemspage(40); + } - $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, - `contact`.`thumb`, `contact`.`self`, - `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 - AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `wall` = 1 ) + AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra - ORDER BY `parent` DESC, `gravity` ASC, `id` ASC LIMIT %d ,%d ", + LIMIT %d ,%d ", intval($a->profile['profile_uid']), intval($a->pager['start']), intval($a->pager['itemspage']) ); + $parents_arr = array(); + $parents_str = ''; + + if(count($r)) { + foreach($r as $rr) + $parents_arr[] = $rr['item_id']; + $parents_str = implode(', ', $parents_arr); + + $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, + `contact`.`thumb`, `contact`.`self`, + `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` + FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `item`.`parent` IN ( %s ) + $sql_extra + ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ", + intval($a->profile['profile_uid']), + dbesc($parents_str) + ); + } if($is_owner && ! $update) $o .= get_birthdays(); @@ -292,6 +313,16 @@ function profile_content(&$a, $update = 0) { if($r !== false && count($r)) { + $comments = array(); + foreach($r as $rr) { + if(intval($rr['gravity']) == 6) { + if(! x($comments,$rr['parent'])) + $comments[$rr['parent']] = 1; + else + $comments[$rr['parent']] += 1; + } + } + foreach($r as $item) { like_puller($a,$item,$alike,'like'); like_puller($a,$item,$dlike,'dislike'); @@ -311,6 +342,25 @@ function profile_content(&$a, $update = 0) { && ($item['id'] != $item['parent'])) continue; + if($item['id'] == $item['parent']) { + $comments_seen = 0; + $comments_collapsed = false; + } + else + $comments_seen ++; + + + if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) { + if(! $comments_collapsed) { + $o .= ''; + $o .= ''; + } + $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) ? '
' . t('Private Message') . '
' -- cgit v1.2.3 From b57214cb783ca2f741760a2ccfbd01babfbd165b Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 27 Mar 2011 19:59:27 -0700 Subject: wrong date order profile page --- mod/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/profile.php') diff --git a/mod/profile.php b/mod/profile.php index 9544512ba..8fb483007 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -260,7 +260,7 @@ function profile_content(&$a, $update = 0) { AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1 $sql_extra - LIMIT %d ,%d ", + ORDER BY `item`.`created` DESC LIMIT %d ,%d ", intval($a->profile['profile_uid']), intval($a->pager['start']), intval($a->pager['itemspage']) -- cgit v1.2.3 From 7defb1768bff1c3da7ea63957cf8c7c928d379ab Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 27 Mar 2011 20:37:44 -0700 Subject: collapse posts by same author (but not you). --- mod/profile.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod/profile.php') diff --git a/mod/profile.php b/mod/profile.php index 8fb483007..1101c6998 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -328,6 +328,8 @@ function profile_content(&$a, $update = 0) { like_puller($a,$item,$dlike,'dislike'); } + $comments_collapsed = false; + foreach($r as $item) { $sparkle = ''; -- cgit v1.2.3