From ddf7eced79bd4d0e88eec6fe894d26c21e42f0ca Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Fri, 17 Aug 2018 19:12:23 +0200 Subject: [PATCH] fixes #3377 Enabled "preview" button on forum post edit disabled subject if edited post is not the first post of the thread --- e107_plugins/forum/forum_post.php | 6 ++++++ e107_plugins/forum/shortcodes/batch/post_shortcodes.php | 6 +++--- e107_plugins/forum/templates/forum_preview_template.php | 5 +++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index 5bb8512db..e9f58c1de 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -155,6 +155,7 @@ class forum_post_handler $forumInfo = $this->forumObj->forumGet($postInfo['post_forum']); $data = array_merge($postInfo ,$forumInfo); $data['action'] = $this->action; + $data['initial_post'] = $this->forumObj->threadDetermineInitialPost($this->post); $this->setPageTitle($data); return $data; break; @@ -1026,6 +1027,11 @@ class forum_post_handler $tsubject = $tp->post_toHTML($_POST['subject'], true); $tpost = $tp->post_toHTML($_POST['post'], true); + if (empty($tsubject)) + { + $tsubject = $this->data['thread_name']; + } + if ($_POST['poll_title'] != '' && check_class($this->forumObj->prefs->get('poll'))) { require_once(e_PLUGIN."poll/poll_class.php"); diff --git a/e107_plugins/forum/shortcodes/batch/post_shortcodes.php b/e107_plugins/forum/shortcodes/batch/post_shortcodes.php index 288d10868..fbb752604 100644 --- a/e107_plugins/forum/shortcodes/batch/post_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/post_shortcodes.php @@ -122,7 +122,7 @@ class plugin_forum_post_shortcodes extends e_shortcode elseif($this->var['action'] == 'edit') { $_POST['subject'] = $this->var['thread_name']; - if($this->var['thread_user'] != USERID && !deftrue('MODERATOR')) + if($this->var['thread_user'] != USERID && !deftrue('MODERATOR') || !$this->var['initial_post']) { $opts['disabled'] = 1; } @@ -196,11 +196,11 @@ class plugin_forum_post_shortcodes extends e_shortcode // This user created the thread and is editing the original post. if($this->var['thread_datestamp'] == $this->var['post_datestamp'] && $this->var['thread_user'] == $this->var['post_user']) { - return ""; + return $ret . ""; } else // editing a reply. { - return ""; + return $ret . ""; } } diff --git a/e107_plugins/forum/templates/forum_preview_template.php b/e107_plugins/forum/templates/forum_preview_template.php index b7e5e220f..c3c014145 100644 --- a/e107_plugins/forum/templates/forum_preview_template.php +++ b/e107_plugins/forum/templates/forum_preview_template.php @@ -27,8 +27,9 @@ $FORUM_PREVIEW = "
//v2.x Bootstrap $FORUM_PREVIEW_TEMPLATE['item'] = "
-
{PREVIEW_SUBJECT}
- {PREVIEW_POST} +

{PREVIEW_SUBJECT}

+
+ {PREVIEW_POST}
"; ?> \ No newline at end of file