Please or Register to create posts and topics.

Widget with category filter

Hi,

First of all: Asgaros is a great plugin! So much easier and better than any other I’ve tried, tested and deleted again!

I’m having two main categories based on languages used, with additional fora underneath. Which means: each forum topic has two versions (Dutch and English), which are presented in the forum pages by the proper shortcode with category filter. That works great!

I use the widgets to display the last entries, but in my case the sidebar should display either Dutch or English category. If I use the widgets “as-is”, I’ll always see all recent topics from all categories appear.

Is it possible to add a category filter to the widgets? Similar to how filtering goes on pages with the shortcode?
I can imagine there’ll be other use cases for such functionality too.

Thanks for your attention,

 

Rens.

Hello @rerubabs

Yes, that would be a nice idea and I will think about implementing it in a future release.

At the moment the widgets can only process the entire dataset.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hello @asgaros,

Any plan to implement the category filter in the widgets?

Currently I’m not adding content to the forum to avoid confusion with users who are presented info that’s not relevant to them.

Thanks in advance!

Hello @rerubabs

The next update may take a while because I am in Asia for a couple of weeks. Thats why I suggest you to directly modify the wp-content/plugins/asgaros-forum/includes/forum-widgets.php file. You can do this directly in the WordPress backend via Plugins -> Editor for example.

Search for the following code (should be around line 61):

$categoriesList = get_terms('asgarosforum-category', array(
    'hide_empty'    => false,
    'exclude'       => $excludeList,
    'meta_query'    => $metaQueryFilter
));

Replace it with the following code:

$categoriesList = get_terms('asgarosforum-category', array(
    'hide_empty'    => false,
    'include'       => '4,6'
));

Note: The 4,6 are two example IDs. Just replace it with one or multiple comma-separated IDs of categories which you want to include.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hello @asgaros,

The solution you mentioned doesn’t work for me: it filters the topics on ALL pages.

I just like to see a selection filter in the widgets such as when having different pages with dedicated forums or categories.

Like when you have a categories for cats and on dogs, and show a page with a forum on resp. cats and dogs. I’d like to add a widget to the dogs page that only shows the new entries regarding dogs. The same holds for the cats page.

Or I could add two widgets on the same page (like a home page) that clusters the new entries for dogs and for cats.

I guess it would be the same filter mechanism you already implemented for pages and posts.

Any idea when you implement this? So far I’m not actively using the forum plugin anymore. If it’s not possible, or will not be implemented I’d like to know too, because I’ll set up the site in a different way then.

Thanks so far!

Hello @rerubabs

Now I get what you exactly plan to do. I am also not very happy with the current implementation of widgets. Especially when using multiple forum-pages based on shortcodes its not possible to refer only to a specific area inside of a widget.

Changing this behavior requires a lot of adjustments inside of the code. I will definitely try to find a solution for this in the future but it will take a good while I guess.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hi @Asgaros

Thanks once again for the quality support you gave me trying to integrate Asgaros with LearnDash.  As we discussed I eventually created the forum outside the course and then used an auto-forwarder for students to find it through a course lesson and then a return button. So it works, and I am really happy with the quality of the forum.

I now have a similar challenge to @rerubabs as I have two separate courses and would like the widget to only display the comments from Forum A for users in Course A and comments from Forum B for users in Course B.

Since this conversation have you been able to update the code to allow for that kind of functionality?

 

Hello @timgoodenoughza

Unfortunately, it is not included yet. However, in the near future I want to focus on improving existing functionality instead of adding bigger new stuff so the chance is high that this enhancement will be included in one of the next updates.

You can track the status on this item by following this GitHub ticket:

https://github.com/Asgaros/asgaros-forum/issues/194

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks for the feedback, I appreciate it. I will be following the github ticket with great interest 🙂