Skip to content

Instantly share code, notes, and snippets.

Created May 12, 2011 23:33
Show Gist options
  • Save anonymous/969680 to your computer and use it in GitHub Desktop.
Save anonymous/969680 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;
} else {
return FALSE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment