diff options
Diffstat (limited to 'actions/widgets/add.php')
-rw-r--r-- | actions/widgets/add.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/actions/widgets/add.php b/actions/widgets/add.php new file mode 100644 index 000000000..07e167a96 --- /dev/null +++ b/actions/widgets/add.php @@ -0,0 +1,43 @@ +<?php
+
+ /**
+ * Elgg widget add action
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ $guid = get_input('user');
+ $handler = get_input('handler');
+ $context = get_input('context');
+ $column = get_input('column');
+
+ $result = false;
+
+ if (!empty($guid)) {
+
+ if ($user = get_entity($guid)) {
+
+ if ($user->canEdit()) {
+
+ $result = add_widget($user->getGUID(),$handler,$context,0,$column);
+
+ }
+
+ }
+
+ }
+
+ if ($result) {
+ system_message(elgg_echo('widgets:save:success'));
+ } else {
+ system_message(elgg_echo('widgets:save:failure'));
+ }
+
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
\ No newline at end of file |