10 // Load Elgg framework
11 @require_once
("../../includes.php");
13 // We need to be logged on for this!
18 define("context","dashboard");
20 // Load global variables
21 global $CFG, $PAGE, $db, $page_owner, $messages;
24 $ident = optional_param('widget',0,PARAM_INT
);
25 $ident = $db->qstr($ident);
26 $widget = get_record_sql("select * from ".$CFG->prefix
."dashboard_widgets where ident = $ident");
28 // Page owner = where the widget resides
29 $page_owner = $widget->owner
;
31 // Do we have permission to touch this?
33 if (run("permissions:check","profile")) {
35 adash_widget_destroy($widget->ident
);
36 adash_widgets_reorder($page_owner);
40 // Get the username of the widget owner
41 $username = user_info("username",$widget->owner
);
44 $messages[] = __gettext("Widget deleted.");
45 $_SESSION['messages'] = $messages;
47 // Redirect back to the dashboard
48 header("Location: " . $CFG->wwwroot
. $username . "/dashboard/");