Jump to content
View in the app

A better way to browse. Learn more.

Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hook for all Forum Pages

Featured Replies

Hi,

Which hook do I need new content to appear above the main forum list, the category list page, topic title list pages, and topic? I need for this to appear above all all forum content.

Or do I need to add several hooks to achieve this? If so, please advise.

Thanks.

  • Author

Maybe someone could edit the title to, 'Hook for all Forum Pages'. 🙄

Thanks.

  • Community Expert

What are you trying to accomplish that you can't do with the page builder and widgets?

image.png

  • Author
9 hours ago, Cedric V said:

What are you trying to accomplish that you can't do with the page builder and widgets?

Hi @Cedric V.

Thank you for commenting.

I've been working on rejigging how categories are presented. Our community has a pretty long list of forums, and it is made longer by the use of the 'feed' layout. I wish to group some categories, and have other categories by themselves, accessible via a tabbed menu, above where the usual list of forums appears.

I've actually gone down a similar route to the one you suggested, and ended up creating a custom block for new menu bar, and have added some CSS. I also wish to avoid using JS, and after an initial misstep of using 'display: none', I have manged to put together an accessible version, using absolute positioning and moving the superfluous forums left, outside of the viewport. I have yet to fully expand this out for all the forums, but it appears to be working correctly in my test theme. Not sure yet what issues might arise when the menu bar is located above the topic lists and topics - how to highlight the relevant menu item. I might need some help with that.

Anyway, I just expected that there would be a single hook to add content (for my new menu bar) above the list of forums, topic titles and topics. But I could not locate it. Instead, I will use the page editor to add the menu bar at those three locations.

Edited by Como

You could use a global template hook like front/global/globalTEmplate , with target PrimaryColumn , after the opening tag with an condition for the app request parameter.


{{if \IPS\Request::i()->app == 'forums'}}
this will be shown on all forum sites
{{endif}}
  • Author
3 minutes ago, Daniel F said:

You could use a global template hook like front/global/globalTEmplate , with target PrimaryColumn , after the opening tag with an condition for the app request parameter.

{{if \IPS\Request::i()->app == 'forums'}}
this will be shown on all forum sites
{{endif}}

Hi @Daniel F

I am sorry - what does that do, exactly?

  • Author
15 hours ago, Daniel F said:

You could use a global template hook like front/global/globalTEmplate , with target PrimaryColumn , after the opening tag with an condition for the app request parameter.

{{if \IPS\Request::i()->app == 'forums'}}
this will be shown on all forum sites
{{endif}}

Further to my previous reply, assuming I understand it correctly, might 'forums' be replaced with 'categories'?

Edit: I think I better understand the above now - it makes the added HTML appear above all forum pages - yes?

Having said that, I still do not properly understand what it does.

Anyway, it is Christmas day - I do not expect to see you or anyone else here today. I should be offline too.

Happy Holidays, all.

Thanks.

Edited by Como

  • Marc changed the title to Hook for all Forum Pages
On 12/25/2025 at 11:56 AM, Como said:

Edit: I think I better understand the above now - it makes the added HTML appear above all forum pages - yes?

Yes, thats correct

  • Author
On 12/24/2025 at 9:30 PM, Daniel F said:

You could use a global template hook like front/global/globalTEmplate , with target PrimaryColumn , after the opening tag with an condition for the app request parameter.

{{if \IPS\Request::i()->app == 'forums'}}
this will be shown on all forum sites
{{endif}}

Hi @Daniel F

Thank you for your help with this.

To do that same within Clubs, would I simply replace 'forums' with 'clubs'?

And is it possible to finesse the above to include additional conditions to check within which category the webpage is contained (so that I can select the relevant button in my new menu bar)?

Thanks.

  • Author

A quick post to avoid any unnecessary by anyone reading this topic.

I don't know what I am doing here (obviously); I am adapting the code from this post, to suit my needs. The only changes are to the last if statement: I removed ! from the second condition and removed two other conditions which seem unnecessary.

{{$forumId = 0;}}
{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'forums'}}
{{$forumId = \IPS\Request::i()->id;}}
{{endif}}

{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'topic'}}
{{try { $topic = \IPS\forums\Topic::loadAndCheckPerms( \IPS\Request::i()->id ); $forumId = $topic->forum_id; } catch( \Exception $e ) {};}}
{{endif}}

{{if ( \IPS\Request::i()->module == 'forums' AND in_array( $forumId, array( 174, 1 , 8, 90 ) ) ) }}
MY MENU BAR
{{endif}}

It works. But I have a lot of nested forums (mostly archives of various kinds) and I must list each forumId separately. How would I go about having the array of forum IDs automatically apply to nested forums? I presume this is possible, but I would have idea of how to achieve this. If not, I guess I'll just have to laboriously add forum IDs.

Thanks.

  • Author

My menu system now works pretty well. I entered in all the forum IDs by hand - there's a lot of them. And there are some more to add in some archived areas. It still would be very helpful to have a method to automatically fetch all sub-forums of the top-level categories so that I do not need to manually edit forum IDs when reorganizing the community.

There is more to it than what I posted before - I'll post instructions if anyone has need of something like this. The menu bar displays at all levels, with the correct button indicated for the sub-community being viewed.

Small bugs:

  • When switching from clubs (which is one of the sub-communities) to one of the sub-communities comprising of true forums, the default button and associated sub-community are briefly displayed until the JS picks the intended target.

  • When back-buttoning to the home page, the menu will switch to the default button and associated content. So, I need a way to make the the selected button stick until another is selected.

All-in-all, I am quite pleased with it. It would be nice to make use of Invision's menu overflow system - I have restricted the menu bar to just five items and with short names so that it displays correctly on mobile devices. I tried having one version for mobile and another for desktop, but I ran into some technical problems. I might try tacking that again. Irrespective, making use of Invision's horizontal scrolling menu (as used for tabs in profiles) would be worth exploring.

  • Author

I do have one question I need answering: following @Daniel F's instructions, the menu bar does not display on the home page. So I instead used the Page Editor to add a copy of the menu bar there. However, I cannot place it at the very top of the PrimaryColumn - it appears below an announcement. Whereas, when using the hook suggested by Daniel, the menu is placed above the same announcement. I would instead add the copy of the menu bar at the top of the home page via another hook, but I cannot locate the correct one. Any help would be appreciated.

Edited by Como

You could try the condition with an additional OR part which checks if \IPS\Request::i()->app is set , if it's probably not set at all for the Landing page!

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.