MyBB Community Forums

Full Version: Changing the name of forum based on theme?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Curious how I can change the name of the forum based on theme? I rememberback on Zetaboards, I had a javascript that changed any text to another(instead of Sonic Blast, it was changed to Tails Blast). Although I don't remember the script to do that or if it'seven possible on MyBB?
(2024-01-01, 08:31 PM)Metallix Wrote: [ -> ]Curious how I can change the name of the forum based on theme? I rememberback on Zetaboards, I had a javascript that changed any text to another(instead of Sonic Blast, it was changed to Tails Blast). Although I don't remember the script to do that or if it'seven possible on MyBB?

Admin CP -> Configuration -> general configuration if I remember correctly, there should be an option to change the forum name and the site name
Something along the lines of the following :
global $mybb;

if(!defined('THIS_SCRIPT'))
{
    return;
}

switch(THIS_SCRIPT)
{
    case 'showthread.php':
    case 'newreply.php':
        $threadID = $mybb->get_input('tid', \MyBB::INPUT_INT);

        $threadData = get_thread($threadID);

        $forumID = (int)$threadData['fid'];
        break;
    case 'forumdisplay.php':
    case 'newthread.php':
        $forumID = $mybb->get_input('fid', \MyBB::INPUT_INT);
        break;
    case 'editpost.php':
        $postID = $mybb->get_input('pid', \MyBB::INPUT_INT);

        $postData = get_post($postID);

        $forumID = (int)$postData['fid'];
        break;
}

$forumData = get_forum($forumID);

if(empty($forumData['fid']))
{
    return;
}

switch((int)$forumData['fid'])
{
    case 9:
        $mybb->settings['bbname'] = 'Some forum name';
        $mybb->settings['bbname_orig'] = 'Some forum name';
        break;
}

In global.php at the global_intermediate hook.

The Hooks plugin should work if you are using PHP 7.1 or lower.
https://github.com/frostschutz/MyBB-Hooks