Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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

    TalkNewsUK - My vBulletin 5.5.2 Demo
    AdminAmmo - My Cloud Demo

    Comment


    • #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


      • #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

        TalkNewsUK - My vBulletin 5.5.2 Demo
        AdminAmmo - My Cloud Demo

        Comment


        • #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


          • #6
            Originally posted by Peter Walker View Post
            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

            TalkNewsUK - My vBulletin 5.5.2 Demo
            AdminAmmo - My Cloud Demo

            Comment


            • #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

              Working...
              X