View Single Post
  #3  
Old 04-01-2005, 04:09 PM
why-not why-not is offline
 
Join Date: Feb 2004
Posts: 218
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi

Real Quick....

User Group Can Change Styles Permissions

Follow me!!!

Go to the Admin Directory....

Open './admin/usergroup.php'

FIND THIS...
Code:
require_once('./includes/adminfunctions_ranks.php');

BELOW IT ADD...
Code:
require_once ( './includes/adminfunctions_template.php' );
FIND THIS...
Code:
			// set default yes permissions (bitfields)
			$ug_bitfield = array(
				'showgroup' => 1,
				'canview' => 1,
				'canviewmembers' => 1,
				'canviewothers' => 1,
				'cagetattachment' => 1,
				'cansearch' => 1,
				'canmodifyprofile' => 1,
				'canthreadrate' => 1,
				'canpostattachment' => 1,
				'canpostpoll' => 1,
				'canvote' => 1,
				'canwhosonline' => 1,
				'allowhidden' => 1,
				'showeditedby' => 1,
				'canseeprofilepic' => 1,
				'canusesignature' => 1,
				'cannegativerep' => 1,
				'canuserep' => 1,
			);
REPLACE WITH...
Code:
			// set default yes permissions (bitfields)
			$ug_bitfield = array(
				'showgroup' => 1,
				'canview' => 1,
				'styleid' => '',
				'canviewmembers' => 1,
				'canviewothers' => 1,
				'cagetattachment' => 1,
				'cansearch' => 1,
				'canmodifyprofile' => 1,
				'canthreadrate' => 1,
				'canpostattachment' => 1,
				'canpostpoll' => 1,
				'canvote' => 1,
				'canwhosonline' => 1,
				'allowhidden' => 1,
				'showeditedby' => 1,
				'canseeprofilepic' => 1,
				'canusesignature' => 1,
				'cannegativerep' => 1,
				'canuserep' => 1,
				'canselectskin' => 1,
			);
FIND THIS...
Code:
	print_yes_no_row($vbphrase['can_download_attachments'], 'usergroup[cangetattachment]', $ug_bitfield['cangetattachment']);
	print_table_break();
	print_column_style_code(array('width: 70%', 'width: 30%'));
REPLACE WITH...
Code:
	print_yes_no_row($vbphrase['can_download_attachments'], 'usergroup[cangetattachment]', $ug_bitfield['cangetattachment']);
	print_yes_no_row($vbphrase['can_select_skin'], 'usergroup[canselectskin]', $ug_bitfield['canselectskin']);

	if ($usergroup['styleid'] == 0)
	{
		$usergroup['styleid'] = -1;
	}

	print_style_chooser_row('usergroup[styleid]', $usergroup['styleid'], $vbphrase['use_default_style'], $vbphrase['force_usergroup_style'], 1);
	print_table_break();
	print_column_style_code(array('width: 70%', 'width: 30%'));
Close and save './admin/usergroup.php'

Open './global.php'

FIND THIS...
Code:
// is style in the forum/thread set?
if ($codestyleid)
{
	// style specified by forum
	$styleid = $codestyleid;
	$userselect = true;
}
else if ($bbuserinfo['styleid'] > 0 AND ($vboptions['allowchangestyles'] == 1 OR ($bbuserinfo['permissions']['adminpermissions'] & CANCONTROLPANEL)))
{
	// style specified in user profile
	$styleid = $bbuserinfo['styleid'];
}
else
{
	// no style specified - use default
	$styleid = $vboptions['styleid'];
}
REPLACE WITH...
Code:
if ( $codestyleid )
{
	$styleid = $codestyleid;
	$userselect = true;
}
else if ( ( $permissions['genericpermissions'] & 16777216 ) <> 0 )
{
	if ( $bbuserinfo['styleid'] > 0 AND ($vboptions['allowchangestyles'] == 1 OR ( $bbuserinfo['permissions']['adminpermissions'] & CANCONTROLPANEL ) ) )
	{
		$styleid = $bbuserinfo['styleid'];
	}
	else
	{
		$styleid = $vboptions['styleid'];
	}
}
else
{
	$styleid = $permissions['styleid'];
}
FIND THIS...
Code:
if ($vboptions['allowchangestyles'])
{

	$stylecount = 0;
	$quickchooserbits = construct_style_options(-1, '--', true, true);
	$show['quickchooser'] = iif ($stylecount > 1, true, false);
	unset($stylecount);
}
else
{
	$show['quickchooser'] = false;
}
REPLACE WITH...
Code:
if ( ( $permissions['genericpermissions'] & 16777216 ) <> 0 )
{
	if ( $vboptions['allowchangestyles'] )
	{
		$stylecount = 0;
		$quickchooserbits = construct_style_options ( -1, '--', true, true );
		$show['quickchooser'] = iif ( $stylecount > 1, true, false );
		unset ( $stylecount );
	}
	else
	{
		$show['quickchooser'] = false;
	}
}
else
{
	$show['quickchooser'] = false;
}
Save, close './global.php'

Open './profile.php'

FIND THIS...
Code:
	if ($vboptions['allowchangestyles'])
	{
		$stylecount = 0;
		if (!empty($stylechoosercache))
		{
			$stylesetlist = construct_style_options();
		}
		$show['styleoption'] = iif($stylecount > 1, true, false);
	}
	else
	{
		$show['styleoption'] = false;
	}
REPLACE WITH...
Code:
	if ( ( $permissions['genericpermissions'] & 16777216 ) <> 0 )
	{
		if ( $vboptions['allowchangestyles'] )
		{
			$stylecount = 0;

			if ( ! empty ( $stylechoosercache ) )
			{
				$stylesetlist = construct_style_options ();
			}

			$show['styleoption'] = iif($stylecount > 1, true, false);
		}
		else
		{
			$show['styleoption'] = false;
		}
	}
	else
	{
		$show['styleoption'] = false;
	}
save, close './profile.php'

Open './includes/init.php'

FIND THIS...
Code:
	'canhaverepleft'           => 8388608,
BELOW IT ADD...
Code:
	'canselectskin'            => 16777216,
save, close './includes/init.php'

Now just run these querys (change 'bbs_' to the TABLE PREFIX YOU ARE USING, if not using one, then just remove it!)
Code:
ALTER TABLE bbs_usergroup ADD styleid TINYINT(1) UNSIGNED NOT NULL default '1';
INSERT INTO bbs_phrase VALUES ( '', -1, 'can_select_skin', 'Can Select Forum Styles', 3 );
INSERT INTO bbs_phrase VALUES ( '', -1, 'use_default_style', 'Use Default Style', 3 );
INSERT INTO bbs_phrase VALUES ( '', -1, 'force_usergroup_style', 'Force this usergroup to use this style only.<br />\r\n<span class=\'smallfont\'>If usergroup can not select styles, select one.</span>', 3 );
After go to Admin Panel >> Language Manger >> click Rebuild All Languages!

Then go to Usergroups >> Usergroup Manager >> Select group

Then configure your groups! (by default all groups have no permission to change styles and they are set to use the default style!!!)

You now have Change Style Permissions Based On User Groups!

I did this real quick, so there is no Admin Help phrases, if you want them I will show you how to add them, just tell me!


c, ya...

Sonia
Attached Images
File Type: png force.png (16.7 KB, 0 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01127 seconds
  • Memory Usage 1,822KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (15)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete