Bold User Title For Certain User Groups

JustBrowsing90

Newcomer

Status

offline

Posts

20

Likes

13

Bits Credits

0

LEVEL

1

200 XP

You need to disable the context menu using JavaScript.
People tend to do this to try and mitigate any ripping of themes, but I'll let you know that doesn't really work. People can get around that.

We currently disallow the context menu if the visitor is a Guest, and not a member. Using a mix of JavaScript, XenForo template IF statement syntax, etc.
HTML:
<!-- If no ID exists for the visitor, they're a guest -->

<xf:if is="!$xf.visitor.user_id">
<!-- Enter code only rendered for guests -->
</xf:if>

<!-- ========================================= -->
<!-- If visitor has an ID, they're not a guest -->

<xf:if is="$xf.visitor.user_id">
<!-- Enter code only rendered for guests -->
</xf:if>

You could use the ladder and place JavaScript in this where the context menu would be disabled.
For global usage, your PAGE_CONTAINER will be rendered on every page.
Post automatically merged:

JustBrowsing90,
You should introduce yourself so I don't have to continue approving your posts ;)
Ah okay, that's a bit over my head at the moment but I really appreciate all the help. I made an introduction thread so you won't have to approve my posts anymore. I apologize for that.
 

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,962

Likes

131,197

Resources

3,400

Bits Credits

503

LEVEL

11

5,910 XP

Ah okay, that's a bit over my head at the moment but I really appreciate all the help. I made an introduction thread so you won't have to approve my posts anymore. I apologize for that.
No problem, I will go ahead and create the custom script for you and provide it momentarily. Using the same code I sent above, you'd place it in your PAGE_CONTAINER template like I specified above.
Post automatically merged:

Just make sure to learn from the code I'm providing you! ❤️
 

JustBrowsing90

Newcomer

Status

offline

Posts

20

Likes

13

Bits Credits

0

LEVEL

1

200 XP

No problem, I will go ahead and create the custom script for you and provide it momentarily. Using the same code I sent above, you'd place it in your PAGE_CONTAINER template like I specified above.
Post automatically merged:

Just make sure to learn from the code I'm providing you! ❤️
Of course. I learn best by being shown things once, then I take it upon myself to expand upon that knowledge so I can use it for other things in the future without having to bother anyone :p
 

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,962

Likes

131,197

Resources

3,400

Bits Credits

503

LEVEL

11

5,910 XP

Of course. I learn best by being shown things once, then I take it upon myself to expand upon that knowledge so I can use it for other things in the future without having to bother anyone :p
To disable the context menu for guests, you would place something like this in your helper_js_global
JavaScript:
// DISABLE CONTEXT MENU FOR GUESTS
    <xf:if is="!$xf.visitor.user_id">
        <script>
            window.addEventListener("contextmenu", (e) => {
                e.preventDefault();
            });
            document.addEventListener("selectstart", (e) => {
                e.preventDefault();
            });
        </script>
    </xf:if>
// ###############################
 

Latest threads

Forum statistics

Threads
58,949
Messages
90,128
Members
55,889
Latest member
DemonsGamer
Top Bottom