Skip to content

Commit

Permalink
Merge pull request #2429 from Stefan-ST/fix-2022
Browse files Browse the repository at this point in the history
Fixes #2022 Close Thread doesn't work via reply
  • Loading branch information
Starpaul20 committed Jun 26, 2016
2 parents 8d720f4 + 1141dfb commit 21df167
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions inc/datahandlers/post.php
Expand Up @@ -878,49 +878,39 @@ function insert_post()

// Perform any selected moderation tools.
$ismod = is_moderator($post['fid'], "", $post['uid']);
if($ismod)
if($ismod && isset($post['modoptions']))
{
$lang->load($this->language_file, true);

$modoptions = $post['modoptions'];
$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];

if(!isset($modoptions['closethread']))
{
$modoptions['closethread'] = $closed;
}

$modoptions_update = array();

// Close the thread.
if($modoptions['closethread'] == 1 && $thread['closed'] != 1)
if(!empty($modoptions['closethread']) && $thread['closed'] != 1)
{
$modoptions_update['closed'] = $closed = 0;
$modoptions_update['closed'] = $closed = 1;
log_moderator_action($modlogdata, $lang->thread_closed);
}

// Open the thread.
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)
if(empty($modoptions['closethread']) && $thread['closed'] == 1)
{
$modoptions_update['closed'] = $closed = 1;
$modoptions_update['closed'] = $closed = 0;
log_moderator_action($modlogdata, $lang->thread_opened);
}

if(!isset($modoptions['stickthread']))
{
$modoptions['stickthread'] = $thread['sticky'];
}

// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)
if(!empty($modoptions['stickthread']) && $thread['sticky'] != 1)
{
$modoptions_update['sticky'] = 1;
log_moderator_action($modlogdata, $lang->thread_stuck);
}

// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])
if(empty($modoptions['stickthread']) && $thread['sticky'] == 1)
{
$modoptions_update['sticky'] = 0;
log_moderator_action($modlogdata, $lang->thread_unstuck);
Expand Down Expand Up @@ -1527,7 +1517,7 @@ function insert_thread()
}

// Perform any selected moderation tools.
if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))
if(is_moderator($thread['fid'], "", $thread['uid']) && isset($thread['modoptions']))
{
$lang->load($this->language_file, true);

Expand Down

0 comments on commit 21df167

Please sign in to comment.