Announcement

Collapse
No announcement yet.

Display a notice for specific usergroups for any specific pages

Collapse
This is a sticky topic.
X
X
Collapse
First Prev Next Last
  • Filter
  • Time
  • Show
Clear All
new posts

    Official - Free Display a notice for specific usergroups for any specific pages

    In some cases, you would want to display a notice for specific usergroups on specific page(s).

    Click image for larger version  Name:	image.png Views:	1 Size:	16.5 KB ID:	13210

    You would normally do this by adding a Notice in AdminCP and then choosing a usergroup in the "User belongs to usergroup" dropdown. But this has the following limitations:
    • You can only select one usergroup. If you need to select multiple usergroups, you'd have to create a separate notice and duplicate it and then change the usergroup. This is cumbersome and hard to maintain especially if you need this for 3 or more usergroups.
    • The "User is browsing channel" dropdown doesn't have the option for all pages on the forum. For example, if you want to display a notice in the "Create New Topic" page, there's no option to display a notice there.

    Enter this mod...(trumpet sound)

    Add this custom CSS in css_additional template in AdminCP or in Sitebuilder > Style > CSS Editor.

    The style I used is the same style used in the Notice by default. Depending on how many usergroups and pages you want to display a notice for and to, choose from one of these:

    For single usergroup on a single page: (Change XX and YY to corresponding page id and usergroup id, respectively)
    Code:
    #vb-page-body.pageXX[data-usergroupid="YY"] .page-title-widget .module-title:after {
        content: 'NOTE: Your post will be moderated.'; /* Update the message accordingly */
        border: 1px solid #E1D47E;
        background: #FCF7D7;
        font-weight: normal;
        font-size: 13px;
        display: block;
        padding: 6px 10px;
        margin-top: 15px;
        border-radius: 3px;
    }
    For single usergroup on multiple pages: (Change XX/ZZ and YY to corresponding page id and usergroup id, respectively)
    Code:
    #vb-page-body.pageXX[data-usergroupid="YY"] .page-title-widget .module-title:after,
    #vb-page-body.pageZZ[data-usergroupid="YY"] .page-title-widget .module-title:after {
        content: 'NOTE: Your post will be moderated.'; /* Update the message accordingly */
        border: 1px solid #E1D47E;
        background: #FCF7D7;
        font-weight: normal;
        font-size: 13px;
        display: block;
        padding: 6px 10px;
        margin-top: 15px;
        border-radius: 3px;
    }
    For multiple usergroups on a single page: (Change XX and YY/ZZ/AA to corresponding page id and usergroup id, respectively)
    Code:
    #vb-page-body.pageXX[data-usergroupid="YY"] .page-title-widget .module-title:after,
    #vb-page-body.pageXX[data-usergroupid="ZZ"] .page-title-widget .module-title:after,
    #vb-page-body.pageXX[data-usergroupid="AA"] .page-title-widget .module-title:after {
        content: 'NOTE: Your post will be moderated.'; /* Update the message accordingly */
        border: 1px solid #E1D47E;
        background: #FCF7D7;
        font-weight: normal;
        font-size: 13px;
        display: block;
        padding: 6px 10px;
        margin-top: 15px;
        border-radius: 3px;
    }
    For multiple usergroups on multiple pages: (Change XX/YY/ZZ and AA/BB/CC to corresponding page id and usergroup id, respectively)
    Code:
    #vb-page-body.pageXX[data-usergroupid="AA"] .page-title-widget .module-title:after,
    #vb-page-body.pageYY[data-usergroupid="BB"] .page-title-widget .module-title:after,
    #vb-page-body.pageZZ[data-usergroupid="CC"] .page-title-widget .module-title:after {
        content: 'NOTE: Your post will be moderated.'; /* Update the message accordingly */
        border: 1px solid #E1D47E;
        background: #FCF7D7;
        font-weight: normal;
        font-size: 13px;
        display: block;
        padding: 6px 10px;
        margin-top: 15px;
        border-radius: 3px;
    }
    To find the page id, right click on the target page, and choose "Inspect element" (or equivalent), search for the <body> tag. The <body> tag has a class attribute that has a value that includes "pageXX" (e.g. page19).

    To find the usergroup id, go to AdminCP > Usergroups > Usergroup Manager. Each usergroup displays the id in the Edit Usergroup dropdown.

    Enjoy!

    #2
    Nice Mod Glenn!!!

    Comment


      #3
      Unfortunately, it does not work for me. I have installed your hook require prefix, can this cause any problem? I tried different user groups and different pages
      A cordial greeting

      Comment


        #4
        Ignore the previous message works perfectly. Thank you for your time and your work. regards
        A cordial greeting

        Comment


        • glennrocksvb
          glennrocksvb commented
          Editing a comment
          Glad the mod works and you sorted out your issue yourself.
      Working...
      X