1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Issue #1336 and Forum menu prefs upgrade and newforumpost_menu fix. e_menu.php pending.

This commit is contained in:
Cameron
2016-02-10 19:51:32 -08:00
parent a9eb2bd727
commit 550968d78a
7 changed files with 287 additions and 106 deletions

View File

@@ -745,7 +745,7 @@ class e107forum
$postInfo['post_thread'] = $newThreadId;
$newPostId = $this->postAdd($postInfo, false);
$this->threadMarkAsRead($newThreadId);
$threadInfo['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'],'dashl');
$threadInfo['thread_sef'] = $this->getThreadsef($threadInfo);
return array('postid' => $newPostId, 'threadid' => $newThreadId, 'threadsef'=>$threadInfo['thread_sef']);
}
@@ -753,6 +753,12 @@ class e107forum
}
function getThreadSef($threadInfo)
{
return eHelper::title2sef($threadInfo['thread_name'],'dashl');
}
function threadMove($threadId, $newForumId, $threadTitle= '', $titleType=0)
{
@@ -2198,6 +2204,42 @@ class e107forum
return $deleted; // return boolean. $threadInfo['thread_total_replies'];
}
/**
* Check for legacy Prefernces and upgrade if neccessary.
*/
public function upgradeLegacyPrefs()
{
e107::getMessage()->addDebug("Legacy Forum Menu Pref Detected. Upgrading..");
$legacyMenuPrefs = array(
'newforumposts_caption' => 'caption',
'newforumposts_display' => 'display',
'newforumposts_maxage' => 'maxage',
'newforumposts_characters' => 'chars',
'newforumposts_postfix' => 'postfix',
'newforumposts_title' => 'title'
);
if($newPrefs = e107::getConfig('menu')->migrateData($legacyMenuPrefs, true)) // returns false if no match found.
{
if(e107::getMenu()->setParms('forum','newforumposts_menu', $newPrefs) !== false)
{
e107::getMessage()->addDebug("Sucessfully Migrated newforumposts prefs from core to menu table. ");
}
else
{
e107::getMessage()->addDebug("Legacy Forum Menu Pref Detected. Upgrading..");
}
}
}
}