Jump to content

Possible to permanently toggle forum categories?


Go to solution Solved by Nathan Explosion,

Recommended Posts

Is it possible to set our entire forum to show all category boards in the toggled mode? Currently, they look like this:

image.png.fce11aec9db4583bd9d8b0886a19d88e.png

Each user can click the toggle close arrow on the right and make the category appear this way:

image.png.b33ad3d435a41911d1d87825936b3a6b.png

I'd like the forum front page to keep all categories permanently toggled, showing a description for each category. To access the sub-boards, I'd like members to have to click into the category to see only the sub-boards in there. Is that possible? Thanks!

Edited by usmf
Link to comment
Share on other sites

On 7/17/2021 at 9:16 AM, Nathan Explosion said:

Edit forums -> front -> index -> index

Find:

<li data-categoryID='{$category->_id}' class='cForumRow ipsBox ipsSpacer_bottom ipsResponsive_pull'>

Change it to:

<li data-categoryID='{$category->_id}' class='cForumRow ipsBox ipsSpacer_bottom ipsResponsive_pull cForumRow_hidden' data-hidden="true">

 

Thank you for this. Works perfectly!

Link to comment
Share on other sites

  • 5 months later...
Marc Stridgen
This post was recognized by Marc Stridgen!

"Thank you for sharing"

Nathan Explosion was awarded the badge 'Helpful' and 10 points.

Asked via another topic - how to do the above for 'some' categories. Do the following:

Identify the IDs of the categories you wish to have collapsed - the ID is in the URL for the category when you hover the mouse of the link for the category. Then...

Edit forums -> front -> index -> index

Find:

<li data-categoryID='{$category->_id}' class='cForumRow ipsBox ipsSpacer_bottom ipsResponsive_pull'>

Change to:

{{$collapseThese = array();}}
<li data-categoryID='{$category->_id}' class='cForumRow ipsBox ipsSpacer_bottom ipsResponsive_pull {{if \in_array($category->_id,$collapseThese)}}cForumRow_hidden' data-hidden="true"{{endif}}'>

Then populate the array() with the IDs of the categories:

{{$collapseThese = array(1,3,5,9,11);}}

Save the template.

User action of toggling the category open/closed will override this

Link to comment
Share on other sites

@Nathan Explosion

Nice solution - there's just a misplaced apostrophe with your code. The <li> line should be:

<li data-categoryID='{$category->_id}' class='cForumRow ipsBox ipsSpacer_bottom ipsResponsive_pull {{if \in_array($category->_id,$collapseThese)}}cForumRow_hidden' data-hidden="true"{{else}}'{{endif}}>

 

Link to comment
Share on other sites

In the absence of a link to the site, here's my suggestions:

  1. Ensure that 3,4,5 are the IDs of the categories you want to have collapsed, and not the IDs of forums within a  category
  2. You test this as a new user, and not someone who may or may not have already toggled open/closed the categories at some point - open a private/incognito window to avoid using locally cached cookies/storage that would contain the references to what you have done in that area.
     
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...