Announcement

Collapse
No announcement yet.

MOD or CSS to identify Channels to EXCLUDE from Notices

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MOD or CSS to identify Channels to EXCLUDE from Notices

    The options provided in Notices Manager doesn't allow for selection/identification of Channels you want to exclude. This is important, as the control here is applied at top levels and as such, applies to all Channels contained therein.

    Can the ability to either select/mark (ideal) or specify by Channel Node ID (cumbersome) be done via CSS (ideal) or by a MOD (less ideal)?

    Click image for larger version

Name:	Screen Shot 2024-07-14 at 4.49.51 PM.png
Views:	1024
Size:	196.9 KB
ID:	30033
    The Linux Community has given me much. I do what I can to return the favor!

    #2
    Checking if a pure CSS solution is possible. It's possible using a mod with combination of JS and CSS.

    Comment


      #3
      Ok, I think this would work.

      Start by setting the "User is browsing channe" option to "Forum". This basically shows the notice to all forum channels.

      Then hide the notice using this custom CSS to be added in css_additional.css template:
      Code:
      body:not(:has(.searchFields_channel[value="x"])) .notice[data-notice-id="y"] {
          display: none;
      }
      Replace x with the node ID of the forum channel where you want to hide the notice. Replace y with the notice ID.

      If you want to hide the notice to multiple channels, then repeat the CSS selector multiple times and specify the corresponding forum channel node ID and separate the selectors with a comma (no comma at the end) as shown below:

      Code:
      body:not(:has(.searchFields_channel[value="x"])) .notice[data-notice-id="y"],
      body:not(:has(.searchFields_channel[value="x"])) .notice[data-notice-id="y"],
      body:not(:has(.searchFields_channel[value="x"])) .notice[data-notice-id="y"],
      body:not(:has(.searchFields_channel[value="x"])) .notice[data-notice-id="y"] {
          display: none;
      }

      Comment


      • glennrocksvb
        glennrocksvb commented
        Editing a comment
        This would only work if the Search box in the header is available. If you set the Guest usergroup without Search permission, then the Search box will not be present and thus the above CSS code would not work.

      #4
      Originally posted by glennrocksvb View Post
      Replace y with the notice ID.
      ??? Where do I find that? AdminCP > Notices > Notices Manager lists the Notices we have, but there is no ID identified with them, not even if I edit one of them.
      The Linux Community has given me much. I do what I can to return the favor!

      Comment


        #5
        Edit the notice in a new tab to display it outside the frame. Then you will see the notice ID in the URL.

        Comment


          #6
          Originally posted by glennrocksvb View Post
          Edit the notice in a new tab
          How do I do that? I either click on the notice title or click on [Edit] and it opens. No option to have it open in a new tab.

          Doh!! Never mind. Figured it out. :What a doofus I am!:
          The Linux Community has given me much. I do what I can to return the favor!

          Comment


            #7
            Works great! Thank you.
            The Linux Community has given me much. I do what I can to return the favor!

            Comment


              #8
              Awesome! That CSS code was untested. Glad to hear it's working.

              Comment


                #9
                Turns out this doesn't work as I expected. Still looking into it so I can report succinctly as to what is happening.
                The Linux Community has given me much. I do what I can to return the favor!

                Comment


                  #10
                  This is the CSS:
                  Code:
                  /* Hide Select Notice from Specific Channel - START */
                  body:not(:has(.searchFields_channel[value="20"])) .notice[data-notice-id="5"] {
                      display: none;
                  }
                  /* Hide Select Notice from Specific Channel - END */
                  
                  ​
                  value="20" is our Archives section which contains three visible Channels. id="5" is the Notice I don't want shown in this section.

                  Using this CSS, that Notice stops being shown throughout the entire Forum. Not what I want.
                  The Linux Community has given me much. I do what I can to return the favor!

                  Comment


                    #11
                    To confirm, you want to only show the Notice with id=5 to Archives category whose nodeid=20 and to all its child forum channels and subchannels?

                    Comment


                      #12
                      No. Without the CSS this Notice is shown to “all users who are browsing channel Forum or one of its child channels.” That’s the issue. Archives, as a section, hierarchically falls under Forum. I don’t want this Notice shown to anyone who is browsing any channels that we have in Archives. This notice isn’t applicable there.
                      The Linux Community has given me much. I do what I can to return the favor!

                      Comment


                        #13
                        Ok so it's the other way around,. You don't want to show the notice to Archives and its child forums?

                        Try this code:
                        Code:
                        /* Hide Select Notice from Specific Channel - START */
                        body::has(.searchFields_channel[value="20"]) .notice[data-notice-id="5"],
                        body::has(.searchFields_channel[value="<Archives child node id>"]) .notice[data-notice-id="5"],
                        body::has(.searchFields_channel[value="<Archives child node id>"]) .notice[data-notice-id="5"],
                        body::has(.searchFields_channel[value="<Archives child node id>"]) .notice[data-notice-id="5"] {
                            display: none;
                        }
                        /* Hide Select Notice from Specific Channel - END */
                        Replace <Archives child node id> with the Archives child forum node id and repeat for each child forum under Archives.

                        Comment


                          #14
                          Nope. That doesn't work either.

                          This isn't a deal breaker. I don't have to have the Notice in question provided at all; it is just a reminder that, unfortunately, most ignore anyway.
                          The Linux Community has given me much. I do what I can to return the favor!

                          Comment


                            #15
                            Oh, there was a typo in the new CSS code I posted. Here's the corrected one:

                            Code:
                            /* Hide Select Notice from Specific Channel - START */
                            body:has(.searchFields_channel[value="20"]) .notice[data-notice-id="5"],
                            body:has(.searchFields_channel[value="<Archives child node id>"]) .notice[data-notice-id="5"],
                            body:has(.searchFields_channel[value="<Archives child node id>"]) .notice[data-notice-id="5"],
                            body:has(.searchFields_channel[value="<Archives child node id>"]) .notice[data-notice-id="5"] {
                                display: none;
                            }
                            /* Hide Select Notice from Specific Channel - END */
                            Make sure to replace <Archives child node id> with the corresponding node id.

                            Comment

                            Users Viewing This Page

                            Collapse

                            There is 1 user viewing this forum topic.

                            • Guest Guest

                            Latest Posts

                            Collapse

                            Working...
                            X
                            Searching...Please wait.
                            An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                            Please push the back button and reload the previous window.'
                            An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                            Please push the back button and reload the previous window.'
                            An internal error has occurred and the module cannot be displayed.
                            There are no results that meet this criteria.
                            Search Result for "|||"