diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-03-28 03:45:20 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-03-28 03:45:20 +0000 |
commit | 6b8b1e26a6bc0e0ee0f0970f430e9240f23bd0d1 (patch) | |
tree | 3d55d439e976368461e402995e13250d4e99c860 /edit_multi.php | |
parent | 9e4cce719aafe736f784a3b7a886e5b5ba3c9ae8 (diff) | |
download | elgg-6b8b1e26a6bc0e0ee0f0970f430e9240f23bd0d1.tar.gz elgg-6b8b1e26a6bc0e0ee0f0970f430e9240f23bd0d1.tar.bz2 |
setting owner correctly for edit multi
Diffstat (limited to 'edit_multi.php')
-rw-r--r-- | edit_multi.php | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/edit_multi.php b/edit_multi.php index 5b78e6691..501e23102 100644 --- a/edit_multi.php +++ b/edit_multi.php @@ -8,17 +8,26 @@ gatekeeper();
set_context('photos');
-
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
- }
-
+
+ // parse out photo guids
$file_string = get_input('files');
$file_array_sent = explode('-', $file_string);
$new_file_array = array();
-
+
+ // set owner of page based on first photo guid
+ $photo_guid = (int)$file_array_sent[0];
+ $photo = get_entity($photo_guid);
+ error_log($photo_guid);
+
+ // set page owner based on owner of photo album
+ set_page_owner($photo->owner_guid);
+ $album = get_entity($photo->container_guid);
+ if ($album) {
+ $owner_guid = $album->container_guid;
+ if ($owner_guid)
+ set_page_owner($owner_guid);
+ }
+
foreach ($file_array_sent as $file_guid) {
if ($entity = get_entity($file_guid)) {
if ($entity->canEdit()){
|