How to filter Entities on the River Tab?

Hi,

im trying to add a new tab to the river called "news".

I would like to have only important entries in the Tab e.g. user xyz created a new video or user added event x.

Entries like user a is now in contact with user b or user a joined group c should not displayed in the tab.

My Problem is that i don't know how to add entries like mentioned above. e.g. all videos by all users.

 

Thats part of the code i have:

...

$rivernews = array();

foreach (elgg_get_entities(array('type'=>'object','subtype'=>'videos')) as $video) {

$rivernews[] = $video->getGUID();

}

 

//$rivernews[] = elgg_get_logged_in_user_guid();

$content.=elgg_list_river(array('subject_guid'=>$rivernews));

 

i know how to show all entries by logged in user with elgg_get_logged_in_user_guid();

or like in the contact tab all posts from contacts.

my foreach loop displays all entities. the video subtype filter doesnt work as any filter subtype doesnt work. so i think theres something wrong, and it displays the default (-> all)

 

So any advice how to filter types of entries (subtypes of entries) from all users?

thanks for your time and help!

Kamelot

  • river activity is fetched via this pages script code -- elgg_list_river($options) -- to filter at this point, the options will need to be specified as you want for the data that you want. Have a browse thru this API call to study it's syntax and parameters and then you should be able to tweak it for the filtering - to your liking.

     

  • thanks for your help.

    I browse thru the API and tried filtering several times without getting a result.

    I'm very new to elgg and php, so it would be very nice if you can give me an example for blog posts or videos or something else.Thx!

  • Activity stream (river) and entities are two different things. The API for the listing river items (elgg_list_river()) doesn't support filtering entities by metadata, which is what you'd need to do.

    What you can do instead is use elgg_list_entities_from_metadata(array('metadata_name' => 'tags', 'metadata_value' => 'news')); You will still need to override the views for the river to add the UI components, though.