BBCODE - Enabling Html For Admin & Mods Only

Tags And Keywordsadministrators, bbcode, html


Subject: BBCODE - Enabling Html For Admin & Mods Only
We solve this problem ny limiting only the use of the code alone html to the Admins and the Moderators (These last solo in the sections in which Moderators result).

Code: [Download] [Hide] [Select]
#
#-----[ OPEN ]--------------------------------------------------
#

posting.php

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

// Set toggles for various options
if ( !$board_config['allow_html'] )
{
$html_on = 0;
}
else
{
$html_on = ( $submit || $refresh ) ? ( ( !empty($_POST['disable_html']) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}

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

// Mod for ALLOW HTML to Admins and Moderators - This Mod esclude HTML code for Users and Anonymous - BEGIN

if ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD) && ( $is_auth['auth_mod'] ))
{
// Set toggles for various options
if ( !$board_config['allow_html'] )
{
$html_on = 0;
}
else
{
$html_on = ( $submit || $refresh ) ? ( ( !empty($_POST['disable_html']) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}
}
else
{
if ( !$board_config['allow_html'] )
{
$html_on = ( $submit || $refresh ) ? ( ( !empty($_POST['disable_html']) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );

}
else
{
$html_on = 0;
}
}
// Mod for ALLOW HTML to Admins and Moderators - This Mod exlude HTML code for Users and Anonymous - END


If you look well in the code replaced it's used:

if ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD) && ( $is_auth['auth_mod'] ))

This trains Admins and Moderators to the use of the html. If you want that only the Admins can use the html you must change this line in:

if ($userdata['user_level'] == ADMIN) && ( $is_auth['auth_mod'] ))

Now: You must add the < table > button in Posting Body:

Code: [Download] [Hide] [Select]
[--OPEN--]

templates/mg_themes/bbcb_mg.tpl

[--FIND--]

<a href="javascript:BBChl()" ><img border="0" src="{BBCB_MG_IMG_PATH}highlight{BBCB_MG_IMG_EXT}" name="highlight" onMouseOver="helpline('highlight')" alt="{L_BBCB_MG_HIGHLIGHT}" title="{L_BBCB_MG_HIGHLIGHT}" class="bbimages" /></a>

[-- AFTER ADD --]

<a href="javascript:BBCtable()" ><img border="0" src="{BBCB_MG_IMG_PATH}table{BBCB_MG_IMG_EXT}" name="highlight" onMouseOver="helpline('table')" alt="{L_BBCB_MG_TABLE}" title="{L_BBCB_MG_TABLE}" class="bbimages" /></a>


Now it needs to remove from all the users the possibility to be able to choose whether to use or I lead the code html in Profile - Control Panel (It's only a matter not to see the function because, if it were also present and the Users choose "Yes" to use him/it, the Code won't work for the change effected in posting.php.

Code: [Download] [Hide] [Select]
[--OPEN--]

templates/mg_themes/profile_add_body.ypl

[--FIND--]

<tr>
<td class="row1"><span class="gen">{L_ALWAYS_ALLOW_HTML}:</span></td>
<td class="row2">
<label><input type="radio" name="allowhtml" value="1" {ALWAYS_ALLOW_HTML_YES} /><span class="gen">&nbsp;{L_YES}</span></label>&nbsp;&nbsp;
<label><input type="radio" name="allowhtml" value="0" {ALWAYS_ALLOW_HTML_NO} /><span class="gen">&nbsp;{L_NO}</span></label>
</td>
</tr>

[-- REPLACE WITH --]

<!--
<tr>
<td class="row1"><span class="gen">{L_ALWAYS_ALLOW_HTML}:</span></td>
<td class="row2">
<label><input type="radio" name="allowhtml" value="1" {ALWAYS_ALLOW_HTML_YES} /><span class="gen">&nbsp;{L_YES}</span></label>&nbsp;&nbsp;
<label><input type="radio" name="allowhtml" value="0" {ALWAYS_ALLOW_HTML_NO} /><span class="gen">&nbsp;{L_NO}</span></label>
</td>
</tr>
-->


Last Chage: Now it needs to remove from the Posting Body the possibility from the consumers to be able to choose whether to use or I lead the code html in a determined Post:

Code: [Download] [Hide] [Select]
[-- OPEN --]

templates/mg_themes/posting_body.tpl

[--FIND--]

<!-- BEGIN switch_html_checkbox -->
<label><input type="checkbox" name="disable_html" {S_HTML_CHECKED} />&nbsp;{L_DISABLE_HTML}</label><br />
<!-- END switch_html_checkbox -->

[-- REPLACE WITH --]

<!--
<!-- BEGIN switch_html_checkbox -->
<label><input type="checkbox" name="disable_html" {S_HTML_CHECKED} />&nbsp;{L_DISABLE_HTML}</label><br />
<!-- END switch_html_checkbox -->
-->


These are the changes that may have used for allowing the Admins and the Moderators to use the Code html.

Subject: Re: Enabling Html For Admin & Mods Only
FYI: I have installed it and not allow Mods, but got this errow

Parse error: syntax error, unexpected T_BOOLEAN_AND in /home/usavngu8/public_html/posting.php on line 504
if ($userdata['user_level'] == ADMIN) && ( $is_auth['auth_mod'] ))

Profile PM  

Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.2396s (PHP: 8% SQL: 92%)
SQL queries: 11 - Debug Off - GZIP Enabled