Put overflow hidden and a fixed width on profile widgets to stop large img coming...
[elgg.git] / mod / widget / delete.php
bloba76027e778678786c931c7c5d1573b21e7d7e441
1 <?php
3 /*
5 Elgg Dashboard
6 http://elgg.org/
8 */
10 // Load Elgg framework
11 @require_once("../../includes.php");
13 // We need to be logged on for this!
15 if (isloggedin()) {
17 // Define context
18 define("context","dashboard");
20 // Load global variables
21 global $CFG, $PAGE, $db, $page_owner, $messages;
23 // Get widget details
24 $ident = optional_param('wid',0,PARAM_INT);
25 $widget = get_record('widgets','ident',$ident);
27 // Page owner = where the widget resides
28 $page_owner = $widget->owner;
30 // Do we have permission to touch this?
31 // If so, wipe it!
32 if (run("permissions:check","profile")) {
34 widget_destroy($widget->ident);
35 widget_reorder($page_owner,$widget->location,$widget->location_id);
39 // Get the username of the widget owner
40 $username = user_info("username",$widget->owner);
42 // Add a message
43 $messages[] = __gettext("Widget deleted.");
44 $_SESSION['messages'] = $messages;
46 // Redirect back to the relevant location
47 switch( $widget->location ) {
48 case 'profile':
49 case '':
50 $redirect_url = $CFG->wwwroot . $username . "/profile/";
51 break;
52 default:
53 // get module from the widget type
54 $module = '';
55 $mod_pos = strpos($widget->type,"::");
56 if ($mod_pos) {
57 $module = substr($widget->type,0,$mod_pos);
59 $redirect_url = widget_get_display_url($module).'?'.widget_get_display_query();
60 break;
62 header("Location: " . $redirect_url);
63 exit;