Skip to content

Instantly share code, notes, and snippets.

@silentworks
Forked from anonymous/gist:969680
Created May 12, 2011 23:56
Show Gist options
  • Save silentworks/969708 to your computer and use it in GitHub Desktop.
Save silentworks/969708 to your computer and use it in GitHub Desktop.
function mywild($userid = '', $offset = 0)
{
/* find favourites for this user */
$rels = $this->db->select('rel_parent')->where('rel_child', $userid)->where('rel_type', 'favourite')->from('content_relationships')->get();
print_r($rels);
if ($rels->num_rows() > 0) {
foreach ($rels->result_array() as $row)
{
$content_ids[] = $row['rel_parent'];
}
/* create date range */
$s = gmdate('Y-m-d 00:00:00', strtotime('-1 months'));
$f = gmdate('Y-m-d 23:00:00');
$r = "content_updated BETWEEN '$s' AND '$f'";
/* associate content with ids */
$feed = $this->db->where($r, NULL, FALSE)->where_in('content_parent', $content_ids)->where('content_status', 'published')->from('content')->limit(5, $offset)->order_by('content_updated', 'desc')->get();
return $feed->result();
} else {
return (object) array();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment