Dear All,
I can able to get the total number of files that i have uploaded in my acccount. I referred many sites and finally i got this
In mod/profile/views/default/profile/owner_block.php I have added this line
$content_menu .= elgg_echo('file');
$content_menu .= ' (';
$content_menu .= elgg_get_entities(array(
'types' => 'object',
'subtypes' => array('file'),
'owner_guids' => page_owner_entity()->guid,
'full_view' => false,
'view_toggle_type' => false,
'count' => true
));
$content_menu .= ')';
And i can able to get the below output
>>>>>Files (5)
But my question is "Is there a way i can get only my image files or video files?" Please help me on this. I tried this
$content_menu .= elgg_echo('file');
$content_menu .= ' (';
$content_menu .= elgg_get_entities(array(
'types' => 'object',
'subtypes' => array('image'),
'owner_guids' => page_owner_entity()->guid,
'full_view' => false,
'view_toggle_type' => false,
'count' => true
));
$content_menu .= ')';
but the output now became Files ()
Please help me on this
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- jothirajan@jothirajan

jothirajan - 0 likes
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- jothirajan@jothirajan

jothirajan - 0 likes
- jothirajan@jothirajan

jothirajan - 0 likes
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- jothirajan@jothirajan

jothirajan - 0 likes
You must log in to post replies.You can try elgg_get_entities_from_metadata();
Use same parameters as in your first example, and add 'metadata_name_value_pairs' or 'metadata_names' and 'metadata_values'. File plugins stores type as 'simpletype' metadata
Dear Ismayil,
Many thanks for your reply. So the code needs to be like below
$content_menu .= elgg_echo('file');
$content_menu .= ' (';
$content_menu .= elgg_get_entities(array(
'types' => 'object',
'subtypes' => array('file'),
'metadata_name_value_pairs' => array(array('name' => 'simpletype', 'value' => 'image')),
'owner_guids' => page_owner_entity()->guid,
'full_view' => false,
'view_toggle_type' => false,
'count' => true
));
$content_menu .= ')';
But it is showing all counts , documents + images + videos please help
User the correct getter function elgg_get_entities_from_metadata();
@Ismayil
Yes i used like below
$fff = elgg_get_entities_from_metadata(array(
'types' => 'object',
'subtypes' => array('file'),
'metadata_name_value_pairs' => array(array('metadata_names' => 'simpletype', 'metadata_values' => 'image')),
'owner_guids' => page_owner_entity()->guid,
'full_view' => false,
'view_toggle_type' => false,
'count' => true
));
But still there is no use, could you please provide a sample code .. Please
Dear Ismayil,
Many thanks for your time and helping me on this. Atlast we got it. Please check my below working code
WOW your words worked atlast sorry the below code is the correct format, i added metadata_ instead of only names and values...
$fff = elgg_get_entities_from_metadata(array(
'types' => 'object',
'subtypes' => array('file'),
'metadata_name_value_pairs' => array(array('name' => 'simpletype', 'value' => 'video')),
'owner_guids' => page_owner_entity()->guid,
'full_view' => false,
'view_toggle_type' => false,
'count' => true
));
I am glad it worked. FYI, full_view and view_toggle_type are of no use unless you are using elgg_list_entities_
Dear Ismayil,
Could you please let me know on how to display only FILE >> Video activity streams
I got this
<?php
$num_items = $vars['entity']->num_items;
if (!isset($num_items)) $num_items = 12;
$widgtet_datas = elgg_view_river_items(0, $widget_group, '', 'object', 'file', '', $num_items,0,0,false);
?>
<div class="contentWrapper">
<?php
if(isset($widgtet_datas)) {
echo $widgtet_datas;
}
?>
But this will show all file subtypes like image, contents, videos etc. If there is any method for us to show only the videos? If so please help me