Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
Disable Right Click For User Groups Details »»
Disable Right Click For User Groups
Version: 1.00, by da_judge da_judge is offline
Developer Last Online: Oct 2019 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 4.x.x Rating:
Released: 02-22-2014 Last Update: Never Installs: 20
Template Edits
Re-useable Code  
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Macgiber

Comments
  #2  
Old 02-23-2014, 08:08 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works well, installed
Reply With Quote
Благодарность от:
da_judge
  #3  
Old 02-24-2014, 10:42 AM
Krusty1231's Avatar
Krusty1231 Krusty1231 is offline
 
Join Date: Jul 2010
Location: Canada
Posts: 366
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Agreed, even better than the one I had. Installed/Rated.
Reply With Quote
Благодарность от:
da_judge
  #4  
Old 02-24-2014, 03:18 PM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If we do this, won't we get two body tags?
Reply With Quote
  #5  
Old 02-24-2014, 06:44 PM
da_judge's Avatar
da_judge da_judge is offline
 
Join Date: Jan 2006
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not on mine mate ? only one body in my header
Reply With Quote
  #6  
Old 02-24-2014, 11:06 PM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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




Attached Images
File Type: png 000656.png (19.3 KB, 0 views)
Reply With Quote
Благодарность от:
RichieBoy67
  #7  
Old 02-25-2014, 09:35 PM
da_judge's Avatar
da_judge da_judge is offline
 
Join Date: Jan 2006
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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..
Reply With Quote
  #8  
Old 07-12-2014, 07:23 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 03-24-2015, 11:53 PM
keyla31's Avatar
keyla31 keyla31 is offline
 
Join Date: Feb 2009
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

beautiful, I love this
Reply With Quote
  #10  
Old 04-10-2015, 02:01 PM
concepts's Avatar
concepts concepts is offline
 
Join Date: May 2005
Location: Woodland Hills, Ca
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:02 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05628 seconds
  • Memory Usage 2,316KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete