MyBB Community Forums

Full Version: Error inserting post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When trying to insert a thread via my plugin, the validator is returning and error saying that the prefix is invalid. The prefix however is completely valid.

This largely depends on the user that I am using at the time. If the post is being inserted by a normal member this fails, if it is being inserted by me that admin it works.

The post data array looks like

Array
(
    [fid] => 16
    [subject] => another ignorable test
    [prefix] => 12
    [icon] => 
    [uid] => 5961
    [username] => testuser
    [message] => test
    [ipaddress] => 213.208.236.186
    [posthash] => 752cb44c138b1f9268b0b38a480d3a61
    [savedraft] => 0
)

and the returned error is

Array ( [0] => The selected prefix is invalid. Please select a valid prefix. ) 

I can't for the life of me figure out why the validator is returning this when the data is correct and no matter which prefix I use in the array I get the same error.

Any thoughts?

I just figured this out. The post validator checks whether the user has permission to post that prefix. I have the prefix reserved so that it can only be used by admins and the bot poster. I need to provide group access and I will have to write a seperate bit of code to hide it when adding a post