I have a problem with widget. I'm using Ultimate cool theme 2.1.1 (WISB), and I can add widget to dashboard, it appears but doesn't work, althought it works well in profile page, group page... How can I fix it?!
Below is my dashboard.php file in WISB/pages folder.
<?php
gatekeeper();
$user = elgg_get_logged_in_user_entity();
elgg_set_page_owner_guid($user->guid);
$title = elgg_echo('newsfeed');
$composer = elgg_view('page/elements/composer', array('entity' => $user));
$db_prefix = elgg_get_config('dbprefix');
$activity = elgg_list_river(array(
'joins' => array("JOIN {$db_prefix}entities object ON object.guid = rv.object_guid"),
'wheres' => array("
rv.subject_guid = $user->guid
OR rv.subject_guid IN (SELECT guid_two FROM {$db_prefix}entity_relationships WHERE guid_one=$user->guid AND relationship='follower')
OR rv.subject_guid IN (SELECT guid_one FROM {$db_prefix}entity_relationships WHERE guid_two=$user->guid AND relationship='friend')
"),
));
$options = array();
$page_type = preg_replace('[\W]', '', get_input('page_type', 'all'));
$type = preg_replace('[\W]', '', get_input('type', 'all'));
$subtype = preg_replace('[\W]', '', get_input('subtype', ''));
if ($subtype) {
$selector = "type=$type&subtype=$subtype";
} else {
$selector = "type=$type";
}
if ($type != 'all') {
$options['type'] = $type;
if ($subtype) {
$options['subtype'] = $subtype;
}
}
switch ($page_type) {
case 'mine':
$title = elgg_echo('river:mine');
$page_filter = 'mine';
$options['subject_guid'] = elgg_get_logged_in_user_guid();
break;
case 'friends':
$title = elgg_echo('river:friends');
$page_filter = 'friends';
$options['relationship_guid'] = elgg_get_logged_in_user_guid();
$options['relationship'] = 'friend';
break;
default:
$title = elgg_echo('river:all');
$page_filter = 'all';
break;
}
$activity = elgg_list_river($options);
if (!$activity) {
$activity = elgg_echo('river:none');
}
$content = elgg_view('core/river/filter', array('selector' => $selector));
//$sidebar = elgg_view('core/river/sidebar');
$params = array(
'title' => $title,
'content' => $composer . $content . $activity,
//'sidebar' => $sidebar,
//'filter_context' => $page_filter,
'class' => 'elgg-river-layout',
);
elgg_set_page_owner_guid(1);
$content = elgg_view_layout('two_sidebar', $params);
echo elgg_view_page($title, $content);
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.
Thank alot RvR. I'm looking forward to hearing from you.
Haven't better of idea like as this.
Try it :)
Thanks for your advides. I'll try it :D
Thanks RvR, you made my day. But I still have problems on add gadget to dashboard. On this post they said:
But I don't know how and where to put this code? After I try all things in this post, in my dashboard there's only one widget (Group activity) in the "Add widget" menu dropdown. But in other pages, it contents all widget I have actived. You can see the images below:
So in the widgets folder of dashboard there's only folder group_activity, nothing else: mod\dashboard\views\default\widgets\group_activity. Is it related with my problem?! Can you give me some advices?
Ok, I resolved my problem. I add the code below into the file start.php of every widget and it works well.
Thanks RvR for your helping.
But I still really don't understand why the widgets appear and work in every page except dashboard, until I add this code above to start.php file?! I think it's really importand for me to continute working with elgg. Can anyone explain about it for me?!
- Previous
- 1
- 2
- Next
You must log in to post replies.