Welcome to OzziesWorld.com. Click here to register

Mods Database - Mod Detail

Mod Title:
Admin Only Styles 1.0.0
Author:
Gary Ostergren (Ozzie)
phpbb Version:
3.0.12
Website:

Description

Adds the ability to determine certain styles as admin only. Allows admins to view different styles without making them available to the entire forum.

Comments

##########################################################################################
## MOD Title: Admin Only Styles
## MOD Author: Ozzie < GOster@OzziesWorld.com > (N/A) http://www.OzziesWorld.com
## MOD Description: Adds the ability to determine certain styles as admin only. Allows
## admins to view different styles without making them available to
## the entire forum.
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit (5):
## adm/styles/acp_styles.html
## includes/functions.php
## includes/acp/acp_styles.php
## language/en/common.php
## language/en/acp/styles.php
##
## Included Files (0):
##########################################################################################
## For Security Purposes, Please Check: http://www.OzziesWorld.com for the
## latest version of this MOD.
##########################################################################################
## Author Notes: 1) None
##########################################################################################
## MOD History:
##
## 2013-11-08 - Version 1.0.0
##
##########################################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##########################################################################################

#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE phpbb_styles ADD admin_only tinyint(1) NOT NULL default '0';

#
#-----[ OPEN ]------------------------------------------
#

adm/styles/acp_styles.html

#
#-----[ FIND ]------------------------------------------
#

<label><input type="radio" class="radio" name="style_active" value="0"<!-- IF not S_STYLE_ACTIVE --> id="style_active" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>

#
#-----[ ADD AFTER ]-------------------------------------
#

<dl>
<dt><label for="admin_only">{L_ADMIN_ONLY}:</label></dt>
<dd><label><input type="radio" class="radio" name="admin_only" value="1"<!-- IF S_ADMIN_ONLY --> id="style_active" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="admin_only" value="0"<!-- IF not S_ADMIN_ONLY --> id="style_active" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>

#
#-----[ OPEN ]------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------
#

function style_select($default = '', $all = false)
{
global $db;

#
#-----[ FIND INLINE]------------------------------------
#

global $db

#
#-----[ ADD AFTER ]-------------------------------------
#

, $mode, $auth, $user

#
#-----[ FIND ]------------------------------------------
#

$sql_where = (!$all) ? 'WHERE style_active = 1 ' : '';
$sql = 'SELECT style_id, style_name

#
#-----[ REPLACE WITH ]----------------------------------
#

$in_acp = ($mode == 'settings' || $auth->acl_get('a_')) ? '' : ' AND admin_only = 0 ';
$sql_where = (!$all) ? 'WHERE style_active = 1 ' . $in_acp : '';
$sql = 'SELECT style_id, style_name, admin_only

#
#-----[ FIND ]------------------------------------------
#

$selected = ($row['style_id'] == $default) ? ' selected="selected"' : '';
$style_options .= '<option value="' . $row['style_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';

#
#-----[ REPLACE WITH ]----------------------------------
#

$disabled = ($row['admin_only'] && $mode == 'settings') ? true : false;
$l_admin_only = ($row['admin_only']) ? $user->lang['STYLE_ADMIN'] : '';
$selected = ($row['style_id'] == $default) ? ' selected="selected"' : '';
$style_options .= '<option value="' . $row['style_id'] . '"' . (($disabled) ? ' disabled="disabled" class="disabled-option"' : $selected) . '>' . $row['style_name'] . $l_admin_only . '</option>';

#
#-----[ OPEN ]------------------------------------------
#

includes/acp/acp_styles.php

#
#-----[ FIND ]------------------------------------------
#

$store_db = request_var('store_db', 0);

#
#-----[ ADD AFTER ]-------------------------------------
#

$admin_only = request_var('admin_only', 0);

#
#-----[ FIND ]------------------------------------------
#

$style_active = 1;

#
#-----[ ADD AFTER ]-------------------------------------
#

$admin_only = 0;

#
#-----[ FIND ]------------------------------------------
#

'style_active' => $style_active,

#
#-----[ ADD AFTER ]-------------------------------------
#

'admin_only' => $admin_only,

#
#-----[ FIND ]------------------------------------------
#

'style_active' => (int) $style_active,

#
#-----[ ADD AFTER ]-------------------------------------
#

'admin_only' => (int) $admin_only,

#
#-----[ FIND ]------------------------------------------
#

'S_STYLE_ACTIVE' => (isset($style_row['style_active'])) ? $style_row['style_active'] : 0,

#
#-----[ ADD AFTER ]-------------------------------------
#

'S_ADMIN_ONLY' => (isset($style_row['admin_only'])) ? $style_row['admin_only'] : 0,

#
#-----[ OPEN ]------------------------------------------
#

language/en/common.php

#
#-----[ FIND ]------------------------------------------
#

'SORT_TOPIC_TIME' => 'Topic time',

#
#-----[ ADD AFTER ]-------------------------------------
#

'STYLE_ADMIN' => ' (Admin)',

#
#-----[ OPEN ]------------------------------------------
#

language/en/acp/styles.php

#
#-----[ FIND ]------------------------------------------
#

'UNSET' => 'Undefined',

#
#-----[ ADD AFTER ]-------------------------------------
#

'ADMIN_ONLY' => 'Admin ONLY Style',

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM