MyBB Community Forums

Full Version: MySQL error in certain parts of ModCP for everybody except my #1 Admin account
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I am logged in as the main (uid=1) Admin account, I can access everything perfectly... but I just realized that anybody I assign as a Mod or ANY level of Admin, cannot access the Mod CP area due to a MySQL error they get.

I have tried the "disable all plugins" option found in the general settings to confirm that a plugin is not responsible. The error still happens when ALL plugins are off.


When they try to go to modcp.php, they get this error:

Quote:SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 5
Query:
SELECT COUNT(aid) AS unapprovedattachments FROM mybb_attachments a LEFT JOIN mybb_posts p ON (p.pid=a.pid) LEFT JOIN mybb_threads t ON (t.tid=p.tid) WHERE a.visible='0' AND t.fid NOT IN ()




If they try going to modcp.php?action=modqueue they get this error:

Quote:SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
Query:
SELECT COUNT(tid) AS unapprovedthreads FROM mybb_threads WHERE visible=0 AND fid NOT IN ()




If they try to go to modcp.php?action=modlogs they get this error:

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

SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 5
Query:
SELECT COUNT(l.dateline) AS count FROM mybb_moderatorlog l LEFT JOIN mybb_users u ON (u.uid=l.uid) LEFT JOIN mybb_threads t ON (t.tid=l.tid) WHERE 1=1 AND t.fid NOT IN ()


...but again, the strangest part about this is that I have always been able to access ALL these areas as the main Administrator account and I still can access them fine right now. What is stopping all other admins/mods from being able to view these 3 sections?
In your modcp.php check if there's any bracket on line 4,5 or 6 but check line 5 first. If there is then copy the whole file and paste it in notepad or notepad++. Then remove the bracket and save the file. Check if the error is still there in "modcp.php?action=modlogs" and "modcp.php?action=modqueue"

The reason why you need to C+P on notepad is because I'm not sure myself so that info will be kept safe if we mess up on something.
I'm not sure I understand what you mean...

I've edited and saved files before so that's no problem. When you say to look for a bracket, can you type the key you mean? Is it this one: ) ?

If it is, then yes there are a ton of those in the file so I'm not sure what you mean to delete.

Also, before I even try... are you sure this would explain my moderators not being able to access the CP but I still can? Remember it's not that the Mod CP is completely broken or that coding seems to be messed up... it's just that the mods/admins I assign can't get in. The areas in the Mod CP all work 100% fine when I am logged in as the #1 Admin.

Would your suggestion explain that? Or is your idea more for if NOBODY can access the Mod CP?
Yes ) is the bracket which I'm referring to. And they can't be "many" on line 5, which is where I asked you to look for.

I would recommend you to reupload your modcp.php file but also mods, do you mean normal mods or super mods?
Found the solution myself.

In the past, I remember having an error when I'd try to view the "announcements" section in the Mod CP.

I remember finding this solution: http://dev.mybb.com/issues/2049

It had me replace some coding with an alternate line of coding to make it so the Announcements area in the Mod CP would stop giving MySQL errors. Well, it seems this fix worked for me but it made it so my other admins/mods cannot access the sections I mentioned before in the Mod CP. Once I reverted back to the original coding (took out what the above link suggested) then everything started working fine again. Oddly enough, the announcement area also seems to work fine now, even though I've effectively REMOVED the "fix" for it.

If anyone else has this same problem and has tried the solution in the link above; try removing the solution above and reverting back to the original line of coding in the Modcp.php file.