How do I restrict use of custom BB Code to specific usergroups?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Walker
    Member
    • Oct 2005
    • 67
    • 3.8.x

    How do I restrict use of custom BB Code to specific usergroups?

    I have a premium area on my forum and I want to restrict the use of certain custom BB codes to those with a premium subscription (30) and a few VIP groups (48,48,50).

    The bbcode is for an audio player and I have named it audiop

    I tried this in the definition of the bb code, but it did not work:

    Code:
    if(is_member_of($vbulletin->userinfo, 30)) 
    { 
    <div class="players" >
            <div class="media-wrapper">
                    <audio id="player2" preload="none" controls controlsList="nodownload" style="width: 100%;">
                        <source src="{param}" type="audio/mp3">
                    </audio>
            </div>
    </div>
    }
    There was no restriction applied and "if(is_member_of($vbulletin->userinfo, 30)) {" was displayed on the page.

    If possible, I would like to add a text that is displayed to people not authorized. Something like" You need a premium subscription to see this."

    How can I get this working?
    Regards

    Peter Walker
    http://www.rifeforum.com
  • Mark.B
    vBulletin Support
    • Feb 2004
    • 24288
    • 6.0.X

    #2
    The software isn't set up to do this.

    Where are you putting this code? You can't use php in the bbcode itself.
    MARK.B
    vBulletin Support
    ------------
    My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
    My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

    Comment

    • Peter Walker
      Member
      • Oct 2005
      • 67
      • 3.8.x

      #3
      This code is in the definition for the custom BB code. As html works, is there any way of doing this?
      Regards

      Peter Walker
      http://www.rifeforum.com

      Comment

      • Mark.B
        vBulletin Support
        • Feb 2004
        • 24288
        • 6.0.X

        #4
        You cannot use php in there, no.

        This would require custom coding, and even then I suspect you may run into issues with the post cache showing the content to the wrong people.
        MARK.B
        vBulletin Support
        ------------
        My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
        My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

        Comment

        • Peter Walker
          Member
          • Oct 2005
          • 67
          • 3.8.x

          #5
          I have made custom BB codes that should always only show content to permitted users - not sure if the cache is important for that, except possibly for those who just joined the special usergroup.
          I was hoping this would be easier than this. I have also been looking into mods to do this, but would prefer a simple permission in the code itself.
          Regards

          Peter Walker
          http://www.rifeforum.com

          Comment

          • Mark.B
            vBulletin Support
            • Feb 2004
            • 24288
            • 6.0.X

            #6
            Originally posted by Peter Walker
            I have made custom BB codes that should always only show content to permitted users - not sure if the cache is important for that, except possibly for those who just joined the special usergroup.
            I was hoping this would be easier than this. I have also been looking into mods to do this, but would prefer a simple permission in the code itself.
            There isn't anything in vB4 that would cover permissions for that and vB4 is no longer being developed.
            This will require custom coding to achieve.
            MARK.B
            vBulletin Support
            ------------
            My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
            My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

            Comment

            • Peter Walker
              Member
              • Oct 2005
              • 67
              • 3.8.x

              #7
              In case someone else is looking for an answer to this, I managed to find a workable solution by adapting a mod on vb.org.

              The Mod is Hide BBCodes/Signatures From Guests/Users and I explain what needs to be changed, there in post #110. I even provide my updated product file.

              So if you need to enable a BBCode in just some forums of your choice, that is the way to do it.
              I have implemented it on my forum and it works well.
              Regards

              Peter Walker
              http://www.rifeforum.com

              Comment

              Related Topics

              Collapse

              • Actron
                "Code" bbcode
                by Actron
                I want to create a custom bbcode like the standart "code" bbcode with no name.... so if i use the custom bbcode there will only show following without the "Code :" on top:
                Code:
                like
                ...
                Mon 7 May '18, 11:00am
              • Danloona
                custom bb code
                by Danloona
                Hi again.

                How I can add to specific usergroup that they will have Animated Gif and colour on their names ?

                I had this code before, so far lost it.

                And also is that...
                Tue 16 Oct '18, 9:39am
              Working...