How to use this "elgg_get_entities"

Hi everyone:

I want function to return array all entity type='object' and subType='blog,file' and created from one week ago to current time,

and then get for each element in array how many likes did it has.

please help ...

  • //Blog created on this week
    
    $start = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
    $end = time();
                    
    $options = array(
        'type' => 'object',
        'subtype' => 'blog',
        'full_view' => false,
        'list_type_toggle' => false,
        'wheres' => array("e.time_created BETWEEN {$start} AND {$end}"),
        'limit' => 30,
        'pagination' => true
    );
    
    $content = elgg_list_entities($options);
    
    echo $content;
  • thanks

    But I want to work in admin side I wouldn't show anything to members I want some thing like SQL query to return me list or array of objects and then make another query to get number of likes for every one.

     

  • $options = array('type'=>'object','subtype'=>'blog');

    $entities= elgg_get_entities($options);

    foreach($entities as $entity){

    echo $entity->title;

    echo elgg_view('likes/count', array('entity' => $entity))

    }