Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 04-04-2008, 04:53 PM
rickles8099 rickles8099 is offline
 
Join Date: Nov 2006
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
any help would be appreciated.
Reply With Quote
  #2  
Old 04-04-2008, 05:26 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
For assistance on where to put this code you need to post in the modification thread, from which you downloaded the modification.
Reply With Quote
Reply

Thread Tools
Display Modes

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 11:37 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.07966 seconds
  • Memory Usage 2,177KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete