Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Blog Post Plugin "Invalid Category" Error

0 votes
61 views
asked Jan 9 in Plugins by civil.engineer
edited Jan 11 by civil.engineer

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'); 
            } 
            } 
       

commented 6 days ago by arjunsuresh
This is a dead plugin AFAIK. The one I use is a paid one blog-tool from Ami. Unfortunately he seems to have stopped maintaining it and being a paid plugin, I dont have the permission to share it. If he allows I can share the code.

1 Answer

0 votes
answered Jan 11 by civil.engineer
Hello again, I shared the articles.php codes which is about the error
...