Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] change permission for admin user
When i try and change some admincp permission for a admin user it gives off this error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1364 - Field 'notes' doesn't have a default value
    INSERT INTO mybb_adminoptions (`uid`,`permissions`) VALUES ('2','a:1:{s:6:\"config\";a:15:{s:8:\"settings\";s:1:\"1\";s:7:\"banning\";s:1:\"0\";s:14:\"profile_fields\";s:1:\"0\";s:7:\"smilies\";s:1:\"0\";s:8:\"badwords\";s:1:\"0\";s:6:\"mycode\";s:1:\"0\";s:9:\"languages\";s:1:\"0\";s:10:\"post_icons\";s:1:\"0\";s:14:\"help_documents\";s:1:\"0\";s:7:\"plugins\";s:1:\"0\";s:16:\"attachment_types\";s:1:\"0\";s:7:\"spiders\";s:1:\"0\";s:9:\"calendars\";s:1:\"0\";s:7:\"warning\";s:1:\"0\";s:9:\"mod_tools\";s:1:\"0\";}}') 

Webserver: IIS7
php: 5.2.9-2
mysql: MySQLi 5.0.83
What version of MyBB are you running? I cannot reproduce.
1scream Founder
Former MyBB Developer & SQA Member
My Twitter
mybb 1.4.7 what i done is this

What i done is add user x to admin group tried to edit that users admin permission (not group) and it gave off that error.
Your running MySQL in Strict mode?
Umm not to sure how do i find out i am also got the setting in config.php to use mysqli
I have similar bug when I try to change admin permission in ACP:

Quote:/home/......./public_html/inc/languages/english/tools_reputations.lang.php does not exist

MyBB 1.4.7

Link: http://www...................../admin/index.php?module=user/admin_permissions&action=edit&uid=0
[Image: moderator-btn.png]
That's not similar, the first post is about mysql. That's a php error.

And as notes, permissions and defaultviews is all in text and has no default value they have to be added as '' in all queries related to inserting into adminoptions.

In admin/inc/functions_view_manager.php
	if($create == true)
		$updated_admin['uid'] = $mybb->user['uid'];
		$db->insert_query("adminoptions", $updated_admin);
needs to change to
	if($create == true)
		$updated_admin['uid'] = $mybb->user['uid'];
		$updated_admin['notes'] = '';
		$updated_admin['permissions'] = '';
		$db->insert_query("adminoptions", $updated_admin);
$db->insert_query("adminoptions", array('uid' => intval($mybb->input['uid']), 'permissions' => $db->escape_string(serialize($mybb->input['permissions']))));
Needs to be:
$db->insert_query("adminoptions", array(
		'uid' => intval($mybb->input['uid']),
		'permissions' => $db->escape_string(serialize($mybb->input['permissions'])),
		'notes' => '',
		'defaultviews' => '',

This will only affect strict versions of MySQL, but alot of people use strict so.
Thanks Martin... Smile
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group

Forum Jump:

Users browsing this thread: 1 Guest(s)