{{indexmenu_n>20}}
====== Superuser [BE] ======
**Backend:** This is a really dirty solution but it works well and should be a fine quick hack to let users work with admin rights but not edit admin section without special superuser check.
Docu: -- \\
Forum: [[http://forum.phpwcms.org/viewtopic.php?p=117699|Quick and dirty Superuser functionality]]
**Autor:** O.Georgi http://phpwcms.de \\
**CMS version:** >= 1.4 \\
**Version:** V1.0 \\
**Tag:** mysite.com/phpwcms.php?superuser=muschi \\
**file name:** navi_text.inc.php
**location:** include/inc_lib/
----
\\
Unzip the attached file {{:english:other-enhancements:hacks:navi_text.inc.php.zip|navi_text.inc.php.zip}}
and replace navi_text.inc.php at include/inc_lib/ (maybe make a backup of original navi_text.inc.php).
Inside that file you can find a new "hidden" word - set it
$phpwcms['superuser_checkword'] = 'muschi';
to whatever you like and keep it in mind.
By default the you will never see the admin menu until you type in the superuser URI like that: \\
**mysite.com/phpwcms.php?superuser=muschi**
See the images:
{{:english:other-enhancements:hacks:superuser01_be.gif|}}
\\
{{:english:other-enhancements:hacks:superuser02_be.gif|}}
\\
{{:english:other-enhancements:hacks:superuser03_be.gif|}}
Then the superuser is registered in session and admin menu will be available as long as your session is active.
\\
~~UP~~
===== Variant 01 =====
Only for this registered admin users the admin menu is available. \\
In the example the user with the username "hans" ans "erwin".
The idea is based on it, that all users with admin rights will not see the admin menu.
**File:** include/inc_lib/navi_text.inc.php
Change
$wcsnav["admin"] = ''.$BL['be_nav_admin'].'';
to
// +KH: 14.04.10 Only for this registered admin users the admin menu is available
// -----------------------------------------------------
if ($_SESSION['wcs_user'] === 'hans' OR
$_SESSION['wcs_user'] === 'erwin')
$wcsnav["admin"] = ''.$BL['be_nav_admin'].'';
// -----------------------------------------------------
\\
~~UP~~
===== Variante 02 =====
Tested with V 1.4.6 r402
for this registered admin users the admin menu is **not** available. \\
In the example the user with the username "oblong" and "don-blech".
The idea is based on it, that all users with admin rights will not see the admin menu.
In addition still the CP-selection for the registered Usern is reduced.
In addition a dupe of the file "include/inc_lib/article.contenttype.inc.php" is produced and the appropriate CPs closed or approved. \\
-> New Filename: "include/inc_lib/article.contenttype_small.inc.php"
\\
==== Menus lock ====
**File:** include/inc_lib/navi_text.inc.php
Replace
$wcsnav["admin"] = ''.$BL['be_nav_admin'].'';
with
// +KH: 14.04.10 Only for this registered admin user the admin menu is available
// -----------------------------------------------------
if ($_SESSION['wcs_user'] !== 'oblong' AND
$_SESSION['wcs_user'] !== 'don-blech')
$wcsnav["admin"] = ''.$BL['be_nav_admin'].'';
// -----------------------------------------------------
\\
==== Filter CPs ====
**File:** phpwcms.php
Replace //(approximately in line 87)//
include(PHPWCMS_ROOT.'/include/inc_lib/article.contenttype.inc.php'); //loading array with actual content types
with
// +KH: 14.04.10 This user has a special contentpart list
// ---------------------------------------------------------
if ($_SESSION['wcs_user'] !== 'oblong' AND $_SESSION['wcs_user'] !== 'don-blech')
include(PHPWCMS_ROOT.'/include/inc_lib/article.contenttype.inc.php'); //loading array with actual content types
else
include(PHPWCMS_ROOT.'/include/inc_lib/article.contenttype_small.inc.php'); //loading array with small content type list
// ---------------------------------------------------------
\\
**The file** "include / inc_lib / article.contenttype_small.inc.php" will be recreated and the non-use CPs commented.
$BL['be_ctype_plaintext'] ,
//kh 6 => $BL['be_ctype_html'],
14 => $BL['be_ctype_wysywig'],
//kh 11 => $BL['be_ctype_code'],
1 => $BL['be_ctype_textimage'],
29 => $BL['be_ctype_imagesdiv'],
//kh 31 => $BL['be_ctype_imagesspecial'],
//kh 32 => $BL['be_ctype_tabs'],
2 => $BL['be_ctype_images'],
//kh 4 => $BL['be_ctype_bulletlist'],
//kh 100 => $BL['be_ctype_ullist'],
//kh 3 => $BL['be_ctype_link'],
5 => $BL['be_ctype_linklist'],
8 => $BL['be_ctype_linkarticle'],
//kh 33 => $BL['be_news'],
15 => $BL['be_ctype_articlemenu'],
//kh 9 => $BL['be_ctype_multimedia'],
7 => $BL['be_ctype_filelist'],
//kh 16 => $BL['be_ctype_ecard'],
//17 => $BL['be_ctype_blog'],
//kh 23 => $BL['be_ctype_simpleform'],
//kh 10 => $BL['be_ctype_emailform'].' [old]',
//kh 12 => $BL['be_ctype_newsletter'],
//kh 13 => $BL['be_ctype_search'],
//kh 18 => $BL['be_ctype_guestbook'],
//kh 19 => $BL['be_ctype_sitemap'],
//20 => $BL['be_ctype_bid'],
//kh 21 => $BL['be_ctype_pages'],
//kh 22 => $BL['be_ctype_rssfeed'],
//kh 50 => $BL['be_ctype_reference'],
//kh 51 => $BL['be_ctype_map'],
//kh 52 => $BL['be_ctype_phpvar'],
//53 => $BL['be_ctype_forum'],
//kh 24 => $BL['be_ctype_alias'],
//kh 89 => $BL['be_ctype_poll'], // jens poll
//kh 26 => $BL['be_ctype_recipe'],
//kh 27 => $BL['be_ctype_faq'],
//kh 28 => $BL['be_ctype_felogin'],
//kh 25 => $BL['be_ctype_flashplayer']
);
// set module content parts = 30
if(count($phpwcms['modules'])) {
foreach($phpwcms['modules'] as $value) {
if($value['cntp']) {
$wcs_content_type[30] = $BL['be_ctype_module'];
break;
}
}
}
?>
The selection order of the CPs in BE depends on the order of the entries in this file. //(See also: [[english/technics/internal-function-call/content-part-types]])//.
\\