MyBB Community Forums

Full Version: Avatar warnings when editing user profile in admincp
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
admin/modules/users/users.php
Warning generated when saving user profile and no avatar_url

<error>
	<dateline>1705500247</dateline>
	<datetime>2024-01-17 14:04:07 UTC -0500</datetime>
	<script>admin/modules/user/users.php</script>
	<line>635</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Undefined array key "avatar_url"</message>
	<back_trace>#0  errorHandler->error() called at [/inc/class_error.php:153]
#1  errorHandler->error_callback() called at [/admin/modules/user/users.php:635]
#2  require() called at [/admin/index.php:834]
</back_trace>
</error>

Find line 635
			else if($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar'])
and replace with
			else if(isset($mybb->input['avatar_url']) && $mybb->input['avatar_url'] != $user['avatar'])

Also, if avatar_url is empty when saving with another error condition, like password change without confirmation of password, then
<error>
	<dateline>1705503990</dateline>
	<datetime>2024-01-17 15:06:30 UTC -0500</datetime>
	<script>admin/modules/user/users.php</script>
	<line>1547</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>Undefined array key "avatar_url"</message>
	<back_trace>#0  errorHandler->error() called at [/inc/class_error.php:153]
#1  errorHandler->error_callback() called at [/admin/modules/user/users.php:1547]
#2  require() called at [/admin/index.php:834]
</back_trace>
</error>

Replace line 1547
			$avatar_url = htmlspecialchars_uni($mybb->input['avatar_url']);
with
		if(isset($mybb->input['avatar_url']))
			{$avatar_url = htmlspecialchars_uni($mybb->input['avatar_url']);}