General

    enRaiser
    By enRaiser

    How you can list two different subtype in one listing.

    Here is the solution .

    $options = array(

    ‘type’ => ‘object’,

    ‘subtype’ => array(‘news’,’event’),

    ‘full_view’ => FALSE,

    ‘limit’ => get_input(‘limit’, $element_limit),

    ‘list_class’ => ‘elgg-list-entity news-list-news’,

    );

     

    Q How will you list users by name, or other metadata?

    A : dont forget that user metadata is not stored in metadata , so metadata_name_value_pair will fail, u need to JOIN user_entity table here. like this

     

    $dbprefix = elgg_get_config(“dbprefix”);

    $options = array(‘type’ => ‘user’,’count’=>true,);

    $options[‘joins’] = array(“JOIN {$dbprefix}users_entity u ON e.guid=u.guid”);

    $options[‘wheres’][] = “u.name = ‘{$name}'”;

    $name_count =   elgg_get_entities_from_metadata($options);