}
}
- if (stristr($order, 'received')) {
+ if (stristr($order, 'pinned_received')) {
+ usort($parents, 'sort_thr_pinned_received');
+ } elseif (stristr($order, 'received')) {
usort($parents, 'sort_thr_received');
} elseif (stristr($order, 'commented')) {
usort($parents, 'sort_thr_commented');
}
/**
- * @brief usort() callback to sort item arrays by the received key
+ * @brief usort() callback to sort item arrays by pinned and the received key
*
* @param array $a
* @param array $b
* @return int
*/
-function sort_thr_received(array $a, array $b)
+function sort_thr_pinned_received(array $a, array $b)
{
if ($b['pinned'] && !$a['pinned']) {
return 1;
return strcmp($b['received'], $a['received']);
}
+/**
+ * @brief usort() callback to sort item arrays by the received key
+ *
+ * @param array $a
+ * @param array $b
+ * @return int
+ */
+function sort_thr_received(array $a, array $b)
+{
+ return strcmp($b['received'], $a['received']);
+}
+
/**
* @brief usort() callback to reverse sort item arrays by the received key
*
*/
function sort_thr_received_rev(array $a, array $b)
{
- if ($b['pinned'] && !$a['pinned']) {
- return -1;
- } elseif (!$b['pinned'] && $a['pinned']) {
- return 1;
- }
-
return strcmp($a['received'], $b['received']);
}
$items = array_merge($items, $pinned);
}
- $o .= conversation($a, $items, $pager, 'profile', $update, false, 'received', $a->profile['profile_uid']);
+ $o .= conversation($a, $items, $pager, 'profile', $update, false, 'pinned_received', $a->profile['profile_uid']);
if (!$update) {
$o .= $pager->renderMinimal(count($items));