MyBB Community Forums

Full Version: Assigned Avatar work with 1.8?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm using a brilliant plugin that automatically assigns a random avatar from a specified folder upon registration. Think it will work with 1.8?

Unfortunately plugin author is horrendous regarding communication, so hoping for a best guess from the experts here.
A great start would to post the name of the plugin. We could probably help more if we had more information.
Thanks for your reply... The name of the plugin is "Assigned Avatar". It's by Yaldaram. This is the function that seems to actually apply the avatar

$plugins->add_hook("datahandler_user_insert", "assigned_avatar");
function assigned_avatar($user){
	global $db, $mybb;

	$power = $mybb->settings['assigned_avatar_power'];
	$folder = $mybb->settings['assigned_avatar_folder'];
	$random_value = $mybb->settings['assigned_avatar_random'];
	$imgtype = $mybb->settings['assigned_avatar_imgtype'];
	if ($power != "0"){
		$random = mt_rand(1, 229);
		$image_name = $random . $imgtype;
		$avatar_assigned = $folder."/". $image_name;
		if(!empty($avatar_assigned)){
			$user->user_insert_data['avatar'] = $db->escape_string($avatar_assigned);
			$user->user_insert_data['avatartype'] = 'remote';
		}
	}