From 316276cb6d6ec61c1c839c81fbe6d96ed1705b49 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 17 Oct 2015 08:27:33 +0200 Subject: [PATCH] Editing an item with an event is now opeing the event edit form. --- mod/events.php | 4 ++++ object/Item.php | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mod/events.php b/mod/events.php index bf53286c2..f2891a38d 100644 --- a/mod/events.php +++ b/mod/events.php @@ -154,6 +154,7 @@ function events_post(&$a) { if(! $cid) proc_run('php',"include/notifier.php","event","$item_id"); + goaway($_SESSION['return_url']); } @@ -165,6 +166,9 @@ function events_content(&$a) { return; } + if($a->argc == 1) + $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; + if(($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) { $r = q("update event set ignore = 1 where id = %d and uid = %d", intval($a->argv[2]), diff --git a/object/Item.php b/object/Item.php index 3050365f9..04c1a707e 100644 --- a/object/Item.php +++ b/object/Item.php @@ -117,9 +117,12 @@ class Item extends BaseObject { ? t('Private Message') : false); $shareable = ((($conv->get_profile_owner() == local_user()) && ($item['private'] != 1)) ? true : false); - if(local_user() && link_compare($a->contact['url'],$item['author-link'])) - $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); - else + if(local_user() && link_compare($a->contact['url'],$item['author-link'])) { + if ($item["event-id"] != 0) + $edpost = array($a->get_baseurl($ssl_state)."/events/event/".$item['event-id'], t("Edit")); + else + $edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit")); + } else $edpost = false; if(($this->get_data_value('uid') == local_user()) || $this->is_visiting()) $dropping = true;