Hello guys
I uploaded Q2A-Blog-Post-Plugin-master plugin, when I try to post a blog, I take "invalid category" error. The plugin give permisson to add 5 categories, I add categories in admin panel; while adding articles I can select these categories but when I click to post, I take this error.
Edit : I found the article.php which is about this error. You can find the code about error, when you search for "INVALID" in codes.
$in=array();
qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']);
$in['title']=qa_post_text('title');
$in['category']=qa_post_text('category');
if (strlen($in['title']) < 10 || strlen($in['content']) < 50 ||
($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5'))
{
if (strlen($in['title']) < 10) $errors['title'] = qa_lang('qa_blog_lang/error_title');
if (strlen($in['content']) < 50) $errors['content'] = qa_lang('qa_blog_lang/error_content');
if ($in['category'] !== 'cat_0' && $in['category'] !== 'cat_1' && $in['category'] !== 'cat_2' && $in['category'] !== 'cat_3' && $in['category'] !== 'cat_4' && $in['category'] !== 'cat_5') $errors['type'] = 'Invalid category';
}
else {
$type = 0;
if ($in['category'] === 'cat_1') $type = 1;
else if ($in['category'] === 'cat_2') $type = 2;
else if ($in['category'] === 'cat_3') $type = 3;
else if ($in['category'] === 'cat_4') $type = 4;
else if ($in['category'] === 'cat_5') $type = 5;
qa_db_query_sub('INSERT INTO ^blog_posts (postid, userid, posted, title, type, content, views,format)
VALUES (0,#,NOW(),$,#,$,0,$)',qa_get_logged_in_userid(),$in['title'],$type,$in['content'],'markdown');
header('location:'.qa_path_to_root().'/user/'.qa_get_logged_in_handle().'/articles');
}
}