1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 23:56:58 +02:00

ENH allow user to delete his own post, if it is the last post in the thread

This commit is contained in:
phibel
2018-09-30 23:17:58 +02:00
parent f480064ba4
commit 3848560752
3 changed files with 80 additions and 18 deletions

View File

@@ -69,9 +69,27 @@ if(vartrue($_GET['id']) && isset($_GET['dl']))
exit;
}
if (isset($_GET['last']))
{
$_GET['f'] = 'last';
}
if(isset($_GET['f']) && $_GET['f'] == 'post')
{
$thread->processFunction();
}
$thread->init();
/* Check if use has moderator permissions for this thread */
$moderatorUserIds = $forum->getModeratorUserIdsByThreadId($thread->threadInfo['thread_id']);
define('MODERATOR', (USER && in_array(USERID, $moderatorUserIds)));
if(e_AJAX_REQUEST)
{
if(varset($_POST['action']) == 'quickreply')
if(varset($_POST['action']) == 'quickreply')
{
$forum->ajaxQuickReply();
}
@@ -85,22 +103,12 @@ if(e_AJAX_REQUEST)
{
$forum->ajaxModerate();
}
else if(varset($_POST['action']) == 'deletepost')
{
$forum->usersLastPostDeletion();
}
}
if (isset($_GET['last']))
{
$_GET['f'] = 'last';
}
if(isset($_GET['f']) && $_GET['f'] == 'post')
{
$thread->processFunction();
}
$thread->init();
/*
if(isset($_POST['track_toggle']))
@@ -145,9 +153,6 @@ define('e_PAGETITLE', strip_tags($tp->toHTML($thread->threadInfo['thread_name'],
$forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']);
/* Check if use has moderator permissions for this thread */
$moderatorUserIds = $forum->getModeratorUserIdsByThreadId($thread->threadInfo['thread_id']);
define('MODERATOR', (USER && in_array(USERID, $moderatorUserIds)));
e107::getScBatch('view', 'forum')->setScVar('forum', $forum);
//var_dump(e107::getScBatch('forum', 'forum'));
@@ -485,6 +490,8 @@ $i = $thread->page;
$sc->wrapper('forum_viewtopic/end');
$forend = $tp->parseTemplate($FORUMEND, true, $sc);
$lastPostDetectionCounter = count($postList);
$sc->setScVar('thisIsTheLastPost', false);
foreach ($postList as $c => $postInfo)
{
@@ -494,6 +501,9 @@ foreach ($postList as $c => $postInfo)
}
$loop_uid = (int)$postInfo['post_user'];
$lastPostDetectionCounter--;
if ($lastPostDetectionCounter == 0) $sc->setScVar('thisIsTheLastPost', true);
//---- Orphan $tnum????
$tnum = $i;