MyBB Community Forums

Full Version: SQL error when copying a category without parent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When copying a category, and the new category doesn't have a parent forum, there's an SQL error because the negative value -1 is inserted into the unsigned integer field pid.
[attachment=42757]

Steps:
-Copy forum
-Source forum: some category
-Destination forum: copy to new forum
-Copy Forum Settings and Properties: No
-Forum type: Category
-Title: something
-Parent forum: none

Since the correct pid for categories without a parent is 0 when adding a new category the value -1 is changed to 0 before it's saved to the database.
https://github.com/mybb/mybb/blob/featur...#L830-L833
But not when a category is copied.

Doing the same when copying a category would be an option to fix this error:
In admin/modules/forum/management.php lines 95-97:
if(!$errors)
{
    $new_forum = $from_forum;

change to:
if(!$errors)
{
    if ($mybb->input['pid'] < 0)
    {
        $mybb->input['pid'] = 0;
    }
    $new_forum = $from_forum;
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3938

Thanks for contributing to MyBB!

Regards,
The MyBB Group
I'm having this problem when trying to create a new CATEGORY for a forum, it has the exact same error...As my Phorum is expanfding i'm adding new Forums as required, but ever since adding the initial forums i added to the myBB install, im getting this error...???? It seeems related to the problem above....

[1] CAN SOMEONE HELP ME VIA PM PLEASE. ( have great sponsors as we need a Dev Team FYI for stuff like this, but will be happppy if someone can help me with this for now.... i can't expand my Phorum until i can add new Forums/Categories ([2] ..I need a marketplace forum also, is there an existing plugin for V.I.P Marketplace/Trading Forum anywhere??? I've looked everywhere... AWESOME IDEA FOR PLUGIN IMHO :-) ....)
Can you list the plugins you have affecting forums and categories ? Or can you give detals about the SQL error ?