From 926e11996080ee84c6c405910c06615b8db55ff5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 23 Dec 2011 19:48:36 -0500 Subject: Fixes #4069 reusing the previous ElggObject for external pages --- mod/externalpages/actions/edit.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'mod/externalpages/actions') diff --git a/mod/externalpages/actions/edit.php b/mod/externalpages/actions/edit.php index edfffe168..184aa3d82 100644 --- a/mod/externalpages/actions/edit.php +++ b/mod/externalpages/actions/edit.php @@ -1,18 +1,28 @@ subtype = $type; -$expages->owner_guid = get_loggedin_userid(); +if ($guid) { + // update + $expages = get_entity($guid); + if (!$expages) { + register_error(elgg_echo("expages:error")); + forward(REFERER); + } +} else { + // create + $expages = new ElggObject(); + $expages->subtype = $type; +} + +$expages->owner_guid = elgg_get_logged_in_user_guid(); $expages->access_id = ACCESS_PUBLIC; $expages->title = $type; $expages->description = $contents; -- cgit v1.2.3