public static function ascend($post, $userparams = null)
{
$posts = null;
if ($userparams instanceof Posts) {
$posts = $userparams;
} else {
$defaultparams = array('where' => "pubdate >= '{$post->pubdate->sql}'", 'content_type' => $post->content_type, 'status' => $post->status, 'limit' => 2, 'orderby' => 'pubdate ASC');
if ($userparams == null) {
$userparams = array();
}
$params = array_merge($defaultparams, $userparams);
$params = Plugins::filter('ascend_filters', $params, $post);
$posts = Posts::get($params);
}
if ($posts) {
// find $post and return the next one.
$index = $posts->search_id($post);
$target = $index + 1;
if (array_key_exists($target, $posts)) {
$ascend = $posts[$target];
return $ascend;
}
}
return false;
}