diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-18 23:01:39 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-18 23:01:39 +0000 |
commit | ebcbf0cb3b4c4053565adc089acfb8bc96605701 (patch) | |
tree | d2fcaba04d6da52016dae5389b92f4cc54853790 /actions/widgets/add.php | |
parent | a24e700999b38185bea3e80dc8461aed271406cb (diff) | |
download | elgg-ebcbf0cb3b4c4053565adc089acfb8bc96605701.tar.gz elgg-ebcbf0cb3b4c4053565adc089acfb8bc96605701.tar.bz2 |
Added functions to support moving and adding widgets
git-svn-id: http://code.elgg.org/elgg/trunk@7340 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/widgets/add.php')
-rw-r--r-- | actions/widgets/add.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/actions/widgets/add.php b/actions/widgets/add.php index c57e3596a..78f73e267 100644 --- a/actions/widgets/add.php +++ b/actions/widgets/add.php @@ -13,21 +13,21 @@ $column = get_input('column', 1); $guid = false; if (!empty($user_guid)) { - if ($user = get_entity($user_guid)) { - if ($user->canEdit()) { - $guid = add_widget($user->getGUID(), $handler, $context, 0, $column); - } - } -} + $user = get_entity($user_guid); + if ($user && $user->canEdit()) { + $guid = elgg_add_widget($user->getGUID(), $handler); + if ($guid) { + $widget = get_entity($guid); + elgg_prepend_widget($widget, $context, $column); -if ($guid) { - system_message(elgg_echo('widgets:add:success')); + // send widget html for insertion + echo elgg_view_entity($widget); - // send widget html for insertion - $widget = get_entity($guid); - echo elgg_view_entity($widget); -} else { - register_error(elgg_echo('widgets:add:failure')); + system_message(elgg_echo('widgets:add:success')); + forward(REFERER); + } + } } +register_error(elgg_echo('widgets:add:failure')); forward(REFERER);
\ No newline at end of file |