The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
restricting a page to certain usergroups
is there a way to restrict access to a certain page by what usergroup a member is in? im pretty sure there is, but each one i try fails to work. the page im trying to restrict is one im sure many is familiar with, its the shoutbox archive found in zero tolerances shoutbox version 2.1. here is the templates code:
Code:
<script type='text/javascript'> <!-- postingShout = false function _ShoutControl() { this.shoutid = -1 this.active = false } _ShoutControl.prototype.Delete = function (shoutid) { if (!this.active) { if (confirm('Are you sure to want to delete this shout message?')) { return this.DoDelete(shoutid) } } return false } _ShoutControl.prototype.DoDelete = function (shoutid) { this.active = true this.shoutid = shoutid doDel = new vB_AJAX_Handler(true) doDel.onreadystatechange(DeleteDone) doDel.send('vbshout.php', 'do=deleteshout&id=' + this.shoutid) return false } _ShoutControl.prototype.Edit = function (shoutid) { if (shoutid != this.shoutid) { if (this.active) { this.cancelActive(this.shoutid) } this.active = true this.shoutid = shoutid // Activate Editor fetch_object('shout_message_edit_' + this.shoutid).style.display = '' fetch_object('shout_message_' + this.shoutid).style.display = 'none' } return false } _ShoutControl.prototype.cancelActive = function (shoutid) { // Deactivate Editor fetch_object('shout_message_edit_' + this.shoutid).style.display = 'none' fetch_object('shout_message_' + this.shoutid).style.display = '' return false } _ShoutControl.prototype.Save = function () { if (this.active) { doShout = new vB_AJAX_Handler(true) doShout.onreadystatechange(SaveDone) if (postingShout) { alert('Posting in progress..') return false } ShoutMsg = fetch_object('shout_message_editor_' + this.shoutid).value if (ShoutMsg.replace(/ /g, '') == '') { alert('You must enter a shout!') return false } doShout.send('vbshout.php', 'do=editshout&id=' + this.shoutid + '&shout=' + PHP.urlencode(ShoutMsg)) postingShout = true } return false } Shout = new _ShoutControl function SaveDone() { if (doShout.handler.readyState == 4 && doShout.handler.status == 200) { postingShout = false Shout.active = false Shout.cancelActive(Shout.shoutid) fetch_object('shout_message_' + Shout.shoutid).innerHTML = doShout.handler.responseText Shout.shoutid = -1 } } function DeleteDone() { if (doDel.handler.readyState == 4 && doDel.handler.status == 200) { ShoutID = Shout.shoutid postingShout = false Shout.active = false Shout.shoutid = -1 if (doDel.handler.responseText == 'true') { fetch_object('shout_top_' + ShoutID).parentNode.removeChild(fetch_object('shout_top_' + ShoutID)) } } } --> </script> <table cellpadding="0" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td width='70%' align='left' valign='top'> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="tcat" align="center"> Shouts </td> </tr> $Output </table> </td> <td width='30%' align='right' valign='top'> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat" align="center" colspan="2"> <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_vbshout_stat')"><img id="collapseimg_forumhome_vbshout_stat" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_vbshout_stat].gif" alt="" border="0" /></a> Statistics </td> </tr> </thead> <tbody id="collapseobj_forumhome_vbshout_stat" style="$vbcollapse[collapseobj_forumhome_vbshout_stat]"> <tr> <td class="alt1" align="left"> <b>Total Shouts:</b> </td> <td class="alt1" width="1%" align="left"> $TS </td> </tr> <tr> <td class="alt1" align="left"> <b>Shouts In Past 24 Hours:</b> </td> <td class="alt1" width="1%" align="left"> $T4 </td> </tr> <tr> <td class="alt1" align="left"> <b>Your Shouts:</b> </td> <td class="alt1" width="1%" align="left"> $TY </td> </tr> </tbody> <tr> <td class="tcat" align="center" colspan="2"> <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_vbshout_top')"><img id="collapseimg_forumhome_vbshout_top" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_vbshout_top].gif" alt="" border="0" /></a> Top 10 Shouters </td> </tr> <tbody id="collapseobj_forumhome_vbshout_top" style="$vbcollapse[collapseobj_forumhome_vbshout_top]"> $TopTen </tbody> </table> </td> </tr> </table> $pagenav |
#2
|
|||
|
|||
There is PHP code which you can use in a Plugin: https://vborg.vbsupport.ru/showthread.php?t=175099#2
You could wrap the entire template in a conditional if you want. Code:
<if condition="!is_member_of($vbulletin->userinfo, X, Y, Z)"> ONLY X, Y AND Z USERGROUPS CAN SEE... <else /> YOU CAN SEE ALL CODE HERE... </if> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|