phpBBHacks.com - Disable a phpBB Powered Page
Community management insight at ManagingCommunities.com
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Add Us:     MySpace     Facebook     StumbleUpon
Username:    Password:
Remember Me?    
Disable a phpBB Powered Page
BlinkList
del.icio.us
Furl
linkaGoGo
reddit
Simpy
Mister Wong
Yahoo! My Web

Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Customizing Your phpBB
 See a User Guidelines violation? Please contact us.
Author Message

Thoul
VIP

Joined: 30 Jul 2002
Posts: 17676
Location: USA

PostPosted: November 27th 2004, 5:43 pm    Post subject: Disable a phpBB Powered Page Reply with quote

Occasionally, you may want to disable a phpBB powered page on your site for some reason. Perhaps you're working on an upgrade or their is a problem with it. Whatever the reason, this guide shows a simple way of adding an option to disable a page in the Administration Control Panel.

You can use this guide to add as many disabling options as you wish. Just change every instance of "somepage" and "SOMEPAGE" in the code below to something unique for each page. Ideally, that should be based on the name of the page somehow.

First, you need to run this SQL query on your database. For more information on running SQL queries, see the Installing phpBB Hacks and Running SQL Queries with db_update.php tutorials.

Code:
INSERT INTO phpbb_config (config_name, config_value) VALUES ('disable_somepage', 0);


Second, make the following file changes to add the option in the Administration Control Panel.
Code:
##
##----------[ OPEN ]-------------------------------------
##

admin/admin_board.php

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

$disable_board_no = ( !$new['board_disable'] ) ? "checked=\"checked\"" : "";
##
##----------[ AFTER, ADD ]-------------------------------
##

//-------------------------------------------------------------------
//  Disable a phpBB Powered Page - Begin Code Addition
//

$disable_somepage_yes = ( $new['disable_somepage'] ) ? 'checked="checked"' : '';
$disable_somepage_no = ( !$new['disable_somepage'] ) ? 'checked="checked"' : '';

//
//  Disable a phpBB Powered Page - End Code Addition
//-------------------------------------------------------------------

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

   "L_DISABLE_BOARD_EXPLAIN" => $lang['Board_disable_explain'],

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

//-------------------------------------------------------------------
//  Disable a phpBB Powered Page - Begin Code Addition
//

   'L_DISABLE_SOMEPAGE' => $lang['Disable_somepage'],
   'L_DISABLE_SOMEPAGE_EXPLAIN' => $lang['Disable_somepage_explain'],

//
//  Disable a phpBB Powered Page - End Code Addition
//-------------------------------------------------------------------

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

   "S_DISABLE_BOARD_NO" => $disable_board_no,
##
##----------[ AFTER, ADD ]-------------------------------
##

//-------------------------------------------------------------------
//  Disable a phpBB Powered Page - Begin Code Addition
//

   'S_DISABLE_SOMEPAGE_YES' => $disable_somepage_yes,
   'S_DISABLE_SOMEPAGE_NO' => $disable_somepage_no,

//
//  Disable a phpBB Powered Page - End Code Addition
//-------------------------------------------------------------------

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

templates/subSilver/admin/board_config_body.tpl

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

   <tr>
      <td class="row1">{L_DISABLE_BOARD}<br /><span class="gensmall">{L_DISABLE_BOARD_EXPLAIN}</span></td>
      <td class="row2"><input type="radio" name="board_disable" value="1" {S_DISABLE_BOARD_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="board_disable" value="0" {S_DISABLE_BOARD_NO} /> {L_NO}</td>
   </tr>
##
##----------[ AFTER, ADD ]-------------------------------
##

<!--  Disable a phpBB Powered Page - Begin Code Addition  -->
   <tr>
      <td class="row1">{L_DISABLE_SOMEPAGE}<br /><span class="gensmall">{L_DISABLE_SOMEPAGE_EXPLAIN}</span></td>
      <td class="row2"><input type="radio" name="disable_somepage" value="1" {S_DISABLE_SOMEPAGE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="disable_somepage" value="0" {S_DISABLE_SOMEPAGE_NO} /> {L_NO}</td>
   </tr>
<!--  Disable a phpBB Powered Page - End Code Addition  -->

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

language/lang_english/lang_admin.php

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

//
// That's all Folks!
// -------------------------------------------------

##
##----------[ BEFORE, ADD ]------------------------------
##
//-------------------------------------------------------------------
//  Disable a phpBB Powered Page - Begin Code Addition
//

$lang['Disable_somepage'] = 'Disable somepage';
$lang['Disable_somepage_explain'] = 'This will make somepage unavailable to users. Administrators are able to access somepage while it is disabled.';

//
//  Disable a phpBB Powered Page - End Code Addition
//-------------------------------------------------------------------


Finally, make the following changes to add the disabling feature to the page itself. You, as an administrator, will be able to access the page even when it has been disabled.

Code:
##
##----------[ OPEN ]-------------------------------------
##

somepage.php

##
##----------[ FIND ]-------------------------------------
##
## Note: This code may vary on some pages.

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_FAQ);
init_userprefs($userdata);
//
// End session management
//

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

//-------------------------------------------------------------------
//  Disable a phpBB Powered Page - Begin Code Addition
//

if ( $userdata['user_level'] != ADMIN && $board_config['disable_somepage']  )
{
   message_die(GENERAL_MESSAGE, 'Disabled_somepage', 'Information');
}

//
//  Disable a phpBB Powered Page - End Code Addition
//-------------------------------------------------------------------

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

language/lang_english/lang_main.php

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

//
// That's all, Folks!
// -------------------------------------------------


##
##----------[ BEFORE, ADD ]------------------------------
##


//-------------------------------------------------------------------
//  Disable a phpBB Powered Page - Begin Code Addition
//

$lang['Disabled_somepage'] = "Sorry, but somepage is currently unavailable at the administration's discretion. Please try again at another time.";

//
//  Disable a phpBB Powered Page - End Code Addition
//-------------------------------------------------------------------


That completes all the necessary changes. You will now be able to disable the chosen page at any time in the Admin Panel's General > Configuration page.
_________________
Phantasy Star: The Fringes of Algo

Install, remove, or upgrade SQL with Advanced DB Update Generator! Now with phpBB 3 Support!

My phpBB Books, Hacks, and Other Works «·» 70+ Listings @ phpBBHacks.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Customizing Your phpBB All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB.it - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - PhotoshopForums.com - DeveloperCube - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Staff - User Guidelines >

Copyright © 2001-2008. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. Hosted by 100MegsWebHosting. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.