MyBB Community Forums

Full Version: Avatar dim for each usergroup 1.6 > 1.8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I have this plugin that makes different avatar dimensions for each usergroup. It works on 1.6 but not properly on 1.8

Can someone help me make it work on 1.8?

The code is below:

<?php

if(!defined("IN_MYBB"))
	die("This file cannot be accessed directly.");

$plugins->add_hook("usercp_avatar_start", "diffavatardim_run");
$plugins->add_hook("usercp_do_avatar_start", "diffavatardim_run");

function diffavatardim_info()
{
	return array(
		'name'			=> 'Different Avatar Dimensions',
		'description'	=> 'Allow different usergroups to have different avatar max dimensions.',
		'version'		=> '1.0'
	);
}

function diffavatardim_run()
{
	global $mybb;
	switch($mybb->user['usergroup'])
	{
		case '4': // admins
			$mybb->settings['maxavatardims'] = '100x100'; // no limit
			break;
		case '3': // Super Moderators
			$mybb->settings['maxavatardims'] = '90x80';
			break;
		case '6': // Sectional Moderators
			$mybb->settings['maxavatardims'] = '90x90';
			break;
           case '2': // Regular Members
			$mybb->settings['maxavatardims'] = '90x70';
			break;
		case '9': // Upgraded Members
			$mybb->settings['maxavatardims'] = '90x70';
			break;

	}
}
?>