Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
330 views
in Q2A Core by
edited by

I know that Q2A is not a blog system but could be useful have an option to hide the reputation system and relative buttons for a specific category ID. So, for example, the admin will be able to create a "blog" category where put posts and not questions. This because in a site not all need to be rated.

in my qa-theme.php

function q_list_item($q_item){
$categoryid = $q_item['raw']['categoryid'];
if ($categoryid == "7"){
qa_html_theme_base::q_list_item($q_item);
$this->output('<style type="text/css"> .qa-vote-buttons, .qa-vote-count{display:none;} </style>');
} else { 
qa_html_theme_base::q_list_item($q_item);}
}
 
 
 function q_list_items($q_items)
        {
   $pagetitle=strlen($this->request) ? strip_tags(@$this->content['title']) : '';         
            if($pagetitle== qa_lang_html('main/recent_qs_title')) { 
                foreach ($q_items as $q_item)
                    if ($q_item['raw']['categoryid'] != 7)
                        $this->q_list_item($q_item);
                
            } elseif($pagetitle== qa_lang_html('main/voted_qs_title')) { 
              foreach ($q_items as $q_item)
                    if ($q_item['raw']['categoryid'] != 7)
                        $this->q_list_item($q_item);
 
            } elseif($pagetitle== qa_lang_html('main/hot_qs_title')) { 
              foreach ($q_items as $q_item)
                    if ($q_item['raw']['categoryid'] != 7)
                        $this->q_list_item($q_item);
 
            } elseif($pagetitle == qa_lang_html('main/answered_qs_title')) { 
              foreach ($q_items as $q_item)
                    if ($q_item['raw']['categoryid'] != 7)
                        $this->q_list_item($q_item);
 
            } elseif($pagetitle == qa_lang_html('main/viewed_qs_title')) { 
              foreach ($q_items as $q_item)
                    if ($q_item['raw']['categoryid'] != 7)
                        $this->q_list_item($q_item);
 
            } else {
                foreach ($q_items as $q_item)
                    $this->q_list_item($q_item);
} }
 
 
 
The code above hide vote buttons for all questions/posts with Category ID 7 and avoid these posts/questions to be listed in many general filter. So the posts/questions of Category with ID 7 is now only visible when you browse this specific category.
 
The only "one" problem is that this code doesn't have effect in single question/post page of Category with ID 7 where user still able to vote. 
 

Can someone, please, point me to the right way?

sorry for my bad english...

Thanks!

Q2A version: 1.6.3

Please log in or register to answer this question.

...