MyBB Community Forums

Full Version: All forums are moderated by Guest !! Username Style Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Today, while looking at index page, Instead of moderator's name, I found under each forum:
Moderated by: Guest
Looking at ACP, I found each forum whith proper and correct moderator info
I dont know when the change occured, but verthing was fine before, so, what I did wrong ? Huh

NB: my board is a conversion from phpbb3
I installed Username Style Plugin
De-activate username style plugin, its causing this error. Try to paste forumbit hook function here, I'll make an edit to you. Smile

For more specific, open plugin file and find;
function usernamestyle_build_forumbits_forum(&$forum)

and paste the entire code within the parenthesis of that function like;
function usernamestyle_build_forumbits_forum(&$forum)
{
// code
}
Thanks Yaldaran
By the way, other users were complaining about the same issue
Here is the function

function usernamestyle_build_forumbits_forum(&$forum)
{
	global $db, $mybb, $lang, $templates, $moderatorcache, $modlistsetting;
	
	// Moderator column is not off
	$mybb->settings['modlist'] = $modlistsetting;
	
	if($mybb->settings['modlist'] != 0)
	{
		$moderators = "";
		$donemoderators = array();
		$parentlist = explode(",", $forum['parentlist']);
		
		foreach($parentlist as $fid)
		{
			if(is_array($moderatorcache[$fid]))
			{
				foreach($moderatorcache[$fid] as $moderator)
				{
					if(in_array($moderator['uid'], $donemoderators))
					{
						continue;
					}
					
					$moderator['username'] = format_name($moderator['username'], $moderator['usergroup'], $moderator['displaygroup']);
					$moderator['profilelink'] = build_profile_link($moderator['username'], $moderator['uid']);
					
					$moderators .= $comma;
					$moderators .= $moderator['profilelink'];
					
					$comma = ", ";
					
					$donemoderators[] = $moderator['uid'];
				}
			}
		}
		
		$comma = "";
		
		if($moderators)
		{
			eval("\$forum['modlist'] = \"".$templates->get("forumbit_moderators")."\";");
		}
		else
		{
			$forum['modlist'] = "";
		}
	}
	
	// To avoid overwriting by original code segment
	$mybb->settings['modlist'] = 0;
	
	// Format lastposter name
	$query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$forum['lastposteruid']."'");
	$user = $db->fetch_array($query);
	
	$forum['lastposter'] = format_name($forum['lastposter'], $user['usergroup'], $user['displaygroup']);
}
Replace this with the following;
function usernamestyle_build_forumbits_forum(&$forum)
{
    global $db, $mybb, $lang, $templates, $moderatorcache, $modlistsetting;
    
    // Moderator column is not off
    $mybb->settings['modlist'] = $modlistsetting;
    
    if($mybb->settings['modlist'] != 0)
    {
        $moderators = "";
        $done_moderators = array(
                    "users" => array(),
                    "groups" => array()
                );
        $parentlistexploded = explode(',', $forum['parentlist']);
        foreach($parentlistexploded as $mfid)
        {
            if(is_array($moderatorcache[$mfid]))
            {
                foreach($moderatorcache[$mfid] as $modtype)
                {
                    foreach($modtype as $moderator)
                    {
                        if($moderator['isgroup'])
                        {
                            if(in_array($moderator['id'], $done_moderators['groups']))
                            {
                                continue;
                            }
                            $moderators .= $comma.htmlspecialchars_uni($moderator['title']);
                            $done_moderators['groups'][] = $moderator['id'];
                        }
                        else
                        {
                            if(in_array($moderator['id'], $done_moderators['users']))
                            {
                                continue;
                            }
                            $moderators .= "{$comma}<a href=\"".get_profile_link($moderator['id'])."\">".format_name(htmlspecialchars_uni($moderator['username']),$moderator['usergroup'],$moderator['displaygroup'])."</a>";
                            $done_moderators['users'][] = $moderator['id'];
                        }
                        $comma = ", ";
                    }
                }
            }
        }
        $comma = "";
        
        if($moderators)
        {
            eval("\$forum['modlist'] = \"".$templates->get("forumbit_moderators")."\";");
        }
        else
        {
            $forum['modlist'] = "";
        }
    }
    
    // To avoid overwriting by original code segment
    $mybb->settings['modlist'] = 0;
    
    // Format lastposter name
    $query = $db->simple_select("users", "usergroup, displaygroup", "uid = '".$forum['lastposteruid']."'");
    $user = $db->fetch_array($query);
    
    $forum['lastposter'] = format_name($forum['lastposter'], $user['usergroup'], $user['displaygroup']);
}
Fixed !!!
Many thanks for help, I really appreciate it
Thanks. Glad I've helped you with the plugin Smile