Viewed only by Admin

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Adavis
Registered User
Posts: 25
Joined: Wed Dec 31, 2003 1:53 pm

Viewed only by Admin

Post by Adavis »

I want a part of code to be viewed only by the site admin.

What changes needed to the .tpl file to do this?
Adavis
User avatar
Lumpy Burgertushie
Registered User
Posts: 68181
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Viewed only by Admin

Post by Lumpy Burgertushie »

Adavis wrote: I want a part of code to be viewed only by the site admin.

What changes needed to the .tpl file to do this?

this will do it:

Code: Select all

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

includes/page_header.php

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

$template->assign_block_vars('switch_user_logged_in', array());

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

// Admin Only View Mod	
	if ( $userdata['user_level'] == ADMIN ) 
   { 
      $template->assign_block_vars('switch_admin_view_only', array()); 
   } 
// Admin Only View Mod

# 
#-----[ OPEN ]------------------------------------------ 
#
#
# templates/subSilver/**file_you_want_to_place_swicth_in**.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
# The code you want to remain hidden from everyone except Administrators

# 
#-----[ BEFORE **CODE**, ADD ]------------------------------------------ 
# 

<!-- BEGIN switch_admin_view_only -->

# 
#-----[ AFTER **CODE**, ADD ]------------------------------------------ 
#

<!-- END switch_admin_view_only -->


# 
#-----[ SAVE & CLOSE ALL FILES ]-------------------------- 
# 
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
Adavis
Registered User
Posts: 25
Joined: Wed Dec 31, 2003 1:53 pm

Re: Viewed only by Admin

Post by Adavis »

Thanks a LOT! It works great!
Adavis
Locked

Return to “2.0.x Support Forum”