MyBB Community Forums
[F] change permission for admin user - Printable Version

+- MyBB Community Forums (http://community.mybb.com)
+-- Forum: Community Archive (/forum-106.html)
+--- Forum: Archived Forums (/forum-143.html)
+---- Forum: Archived Development and Support (/forum-155.html)
+----- Forum: Archived Bug Reports (/forum-74.html)
+------ Forum: MyBB 1.4.6 (/forum-116.html)
+------ Thread: [F] change permission for admin user (/thread-51407.html)



[F] change permission for admin user - ChrisR - 06-16-2009 08:36 AM

When i try and change some admincp permission for a admin user it gives off this error

Code:
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1364 - Field 'notes' doesn't have a default value
Query:
    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\";}}')

Using:
Webserver: IIS7
php: 5.2.9-2
mysql: MySQLi 5.0.83


RE: change permission for admin user - DougSD - 06-16-2009 02:08 PM

What version of MyBB are you running? I cannot reproduce.


RE: change permission for admin user - ChrisR - 06-16-2009 02:21 PM

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.


RE: change permission for admin user - Ryan Gordon - 06-16-2009 03:17 PM

Your running MySQL in Strict mode?


RE: change permission for admin user - ChrisR - 06-16-2009 03:19 PM

Umm not to sure how do i find out i am also got the setting in config.php to use mysqli


RE: change permission for admin user - DamYan - 06-17-2009 04:57 PM

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


RE: change permission for admin user - Martin M. - 06-17-2009 05:18 PM

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
PHP Code:
    if($create == true)
    {
        
$updated_admin['uid'] = $mybb->user['uid'];
        
$db->insert_query("adminoptions"$updated_admin);
    } 
needs to change to
PHP Code:
    if($create == true)
    {
        
$updated_admin['uid'] = $mybb->user['uid'];
        
$updated_admin['notes'] = '';
        
$updated_admin['permissions'] = '';
        
$db->insert_query("adminoptions"$updated_admin);
    } 
admin/modules/user/admin_permissions.php
PHP Code:
$db->insert_query("adminoptions", array('uid' => intval($mybb->input['uid']), 'permissions' => $db->escape_string(serialize($mybb->input['permissions'])))); 
Needs to be:
PHP Code:
$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.


RE: change permission for admin user - Tomm M - 06-19-2009 11:12 AM

Thanks Martin... Smile


[F] change permission for admin user - Tomm M - 06-19-2009 11:12 AM

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