Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
in Q2A Core by
The recently active thread list is calculated in 'activity.php' in '$root$/qa-include/pages/', and considers the category (or backpath) you possibly added to the url. To hide one category you could modify the code there (and do this at every update of the core), or alter (or even wholly recalculate) the list of active threads just before it is being printed as HTML. You can do the latter in a custom theme, perusing the code in the core ('/pages/activity.php', '/db/selects.php'). If you want to avoid any overhead you have to make a page plugin mimicking the activity page.
Thanks for your comment. it will very help for me if you write a code for me.
Do you want to hide only from the activity page or from all question listings?
Thanks for your Response. Basically I Use activity page is my home page. So i want to hide from only activity page.
Oh. That is not very easy though possible. Issue is RA page selects recent questions, answers, comments, and edits.

See the code in qa-include/pages/activity.php

$categoryslugs = qa_request_parts(1);
$countslugs = count($categoryslugs);
$userid = qa_get_logged_in_userid();

//      Get lists of recent activity in all its forms, plus category information

So, here you need to do
if categoryslugs == null,
get all categories to it except the one you want to exclude.

This should do your required work. Just that this needs to be done on every core upgrade.
Thanks For give Your Time
If you don't want to write custom code you can consider using this plugin which hides questions having specified tags from the whole site. This requires a modified selects.php file for pagination to work properly but if you need that I have it.

Wow! Thanks For Share . I Have a opensource q2a site without any ads. There are about 20 moderator for approve question and answer. But sometimes some one do wrong and approve wrong answer. For this cause i want to detect who approve it.  can you made a plugin for me?

and if flagged anyone must required a comment like as questions closing
That is not very difficult as all events are going to Q2A database. But I'm currently too busy with some pending plugins for Q2A.

May be you can simply run the following query
select * from qa_eventlog where event like 'a_select'
I'm beginner and starting learning program. I will try if failed i knock you :)
"all events are going to Q2A database" => Actually, this isn't always true as that behavior depends on the Event Logger plugin, which can be disabled (more info here: http://www.question2answer.org/qa/36034 ). Event Logger is an intensive resource-consuming plugin.

I think it would be better to write an event module to handle ONLY those approvals (note it is not 'a_select' but rather 'q_approve' and 'a_approve' the events that should be listened to). That plugin would store in the database all those approvals (in a custom table, of course). Then the plugin should have to add another sub-menu page (e.g. admin/mod-approved) which would display all the questions/answers that where approved and by whom.
Thanks for the clarification pupi. Actually I got confused with "wrong answer approval" which means selecting best answer.
"So, here you need to do
if categoryslugs == null,
get all categories to it except the one you want to exclude. "

I'm not able to understand it. please help me for activity page
why not to add CSS .. display:none . on the activity page . it think it more easilly .

just add plugin widget everywhere for your site ,, and add this code on the activity page  

.qa-nav-cat { display:none;}
edited by
Here's a start : https://github.com/BrunoVandekerkhove/q2a-hide-category (not tested 100% yet). There should barely be any overhead as it overrides a function from the core instead of doing any of the things I mentioned above.
That is fantastic work Bruno :)
Thank you man
Thanks a lot Ada Donie Abdullah
yup ur welcome (y)
Hi  @Bruno Vandekerkhove when I activate your plugin see 500 error and error log page message I share

[18-Nov-2017 10:41:10 UTC] PHP Warning:  require_once(/home/boyco/public_html/beta/qa-plugin/q2a-hide-category/qa-hide-category-functions.php): failed to open stream: No such file or directory in /home/boyco/public_html/beta/qa-include/qa-base.php(723) : eval()'d code on line 25
[18-Nov-2017 10:41:10 UTC] PHP Fatal error:  require_once(): Failed opening required '/home/boyco/public_html/beta/qa-plugin/q2a-hide-category/qa-hide-category-functions.php' (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/boyco/public_html/beta/qa-include/qa-base.php(723) : eval()'d code on line 25
@suis Is qa-hide-category-functions.php in that directory?

1 Answer

+1 vote

Thanks a lot Bruno Vandekerkhove for make a plugin for solve this problem. 

I am not a professional developer but i try to solve the problem another way.

first time i clone and add a page /qa-include/app/q-list.php to /qa-include/app/a-q-list.php

after that i add

                if($fields['raw']['categoryid'] != 66)
                $qa_content['q_list']['qs'][] = $fields;

by replace 

               $qa_content['q_list']['qs'][] = $fields;

on    /qa-include/app/a-q-list.php

after that i edit activity page /qa-include/pages/activity.php

require_once QA_INCLUDE_DIR.'app/q-list.php'; to require_once QA_INCLUDE_DIR.'app/a-q-list.php';

Then I able to remove my category question from the activity page. My category id was 66

It is not a good way
1. It is a core hack- requires change for every core update, possible issue with plugins.
2. It is actually hiding the question from the list- suppose 20 questions are from category 66 I suppose the activity page will be mostly empty
Happy to say and tell that i am not professional. I am on study mode. This is core hack but it works and i check that activity page shows the number of questions that i set on /admin/lists
Thanks for your comment :)
oh, you mean even after hiding some questions, the number of questions is correct on the Activity page? Then I have to see the page code, because on other question listings that is not the case, may be for activity it is different.