vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Forum Home Enhancements - Disable Right Click For User Groups (https://vborg.vbsupport.ru/showthread.php?t=308803)

da_judge 02-22-2014 11:00 PM

Disable Right Click For User Groups
 
1 Attachment(s)
This is a simple modification for your header template.

Not sure if this been posted before but though i would share it.

You can prevent chosen usergroups from using right click or ctrl+c etc

To Install is very simple, open your header template and paste code below at the top.

You must add the usergroups you want to stop using right click, separated by a comer :)

Code:

<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">
<body style="user-select: none; -khtml-user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -o-user-select: none;">
<script language="javascript" type="text/javascript">

document.oncontextmenu=RightMouseDown;
document.onmousedown = mouseDown;



function mouseDown(e) {
    if (e.which==3) {//righClick
     
    }
}


function RightMouseDown() { return false; }

</script>

</vb:if>


Tested in Internet Explorer, Firefox and Chrome

ForceHSS 02-23-2014 08:08 PM

Works well, installed

Krusty1231 02-24-2014 10:42 AM

Agreed, even better than the one I had. Installed/Rated.

Seven Skins 02-24-2014 03:18 PM

If we do this, won't we get two body tags?

da_judge 02-24-2014 06:44 PM

Not on mine mate ? only one body in my header :)

Seven Skins 02-24-2014 11:06 PM

1 Attachment(s)
This is what I am saying .. this screen shot is from your own site.
Find a way to append css to body tag.




https://vborg.vbsupport.ru/external/2014/02/9.png

da_judge 02-25-2014 09:35 PM

My point is.. it works with 0 issues

It cause no problems that i see.. i been using for over a year.. just thought id share..

thetechgenius 07-12-2014 07:23 PM

I like this!

I just changed around some code, and added a bit of code for my needs.
My code gives the Usergroup a small message when they right click. I have Right-Click disabled for Guests, so when a guest tries to right click, the message they get is: "Right Click is Disabled for Guests!"

Here is my code, if anyone would like to use it:



Code:


<!-- Disable Right click for Usergroups Begin -->
<vb:if condition="is_member_of($bbuserinfo, 1,8)">
<body style="user-select: none; -khtml-user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; -o-user-select: none;">
<script type="text/javascript">
function catch_click(e)
{
    if (!e) var e = window.event;

    var right_click = (e.which ? (e.which == 3) : (e.button == 2));

    if (right_click)
    {
        alert('Right Click is Disabled for Guests!');
        return false;
    }
}

document.onmousedown = catch_click;
if (document.captureEvents) document.captureEvents(Event.MOUSEDOWN);
</script>
 

</vb:if>
<!-- Disable Right click for Usergroups End -->

Change the code in RED to your liking. That's the message the Usergroups get when they Right Click, and the Usergroups that cannot right click.

All credit goes to the OP da_judge, I just changed the code a bit. Thank You!!

If anyone wants to see the popup message before adding this code, go to my site and try it yourself. You dont need to login or anything, I have Disabled Right Click for Guests.
Demo: https://thetechgenius.net

keyla31 03-24-2015 11:53 PM

beautiful, I love this

concepts 04-10-2015 02:01 PM

Thanks!


All times are GMT. The time now is 09:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01027 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete