From d45a24be28b2eb2d0c2731708b589788a5b87215 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 22 Aug 2010 21:11:36 +0000 Subject: Merged r6671:6683 from 1.7 branch to trunk git-svn-id: http://code.elgg.org/elgg/trunk@6847 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/widgets.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'engine/lib/widgets.php') diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 7884f263a..1862ef7e4 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -201,9 +201,9 @@ function display_widget(ElggObject $widget) { } /** - * Add a new widget + * Add a new widget instance * - * @param int $user_guid User GUID to associate this widget with + * @param int $entity_guid GUID of entity that owns this widget * @param string $handler The handler for this widget * @param string $context The page context for this widget * @param int $order The order to display this widget in @@ -211,15 +211,15 @@ function display_widget(ElggObject $widget) { * @param int $access_id If not specified, it is set to the default access level * @return true|false Depending on success */ -function add_widget($user_guid, $handler, $context, $order = 0, $column = 1, $access_id = null) { - if (empty($user_guid) || empty($context) || empty($handler) || !widget_type_exists($handler)) { +function add_widget($entity_guid, $handler, $context, $order = 0, $column = 1, $access_id = null) { + if (empty($entity_guid) || empty($context) || empty($handler) || !widget_type_exists($handler)) { return false; } - if ($user = get_user($user_guid)) { + if ($entity = get_entity($entity_guid)) { $widget = new ElggWidget; - $widget->owner_guid = $user_guid; - $widget->container_guid = $user_guid; + $widget->owner_guid = $entity_guid; + $widget->container_guid = $entity_guid; if (isset($access_id)) { $widget->access_id = $access_id; } else { @@ -237,7 +237,6 @@ function add_widget($user_guid, $handler, $context, $order = 0, $column = 1, $ac // save_widget_location($widget, $order, $column); return true; - } return false; -- cgit v1.2.3