1
Burning
Gui theme per user ?
  • 2009/12/16 21:46

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi' all dev

Sorry in advance for poor english

In my XOOPS back office, I would like to hide some informations to my administrators but keep it displayed for me (because I'm a super-administrator).

I give you an example, with News module. There are several tabs to modify parameters. Eg, I want to hide Permissions tab to my admins but keep it available for me. A best way would be - instead of hiding permission link - forbid access... but I guess it is some hard coding to do, module per module.

So, I would be happy if I can assign a GUI Theme per Group :
• a complete GUI theme for me (= default), wich belongs to Webmaster group
• a GUI theme with less information and links for my admins, wich belongs to an other Group

Is there a "simple" way to do that ? I haven't see any information in users table related to GUI admin

Thanks

2
trabis
Re: Gui theme per group ?
  • 2009/12/17 0:09

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


You can edit system/class/cpanel.php and change the constructor into:
/**
     * Constructer
     *
     */
    
function __construct()
    {
        global 
$xoopsUser;
        if (
$xoopsUser->getVar('uid') == 1) {
            
$cpanel 'oxygen';
        } else {
            
$cpanel 'default';
        }
        
$this->loadGui($cpanel);
    }


User 1 will have oxygen and all others will have default cpanel.

Regarding permissions, you can edit file include/cp_header.php and create a page blacklist so the user gets a redirect message if he is trying to reach one of them.
Here is one example(not hacker proof, use of reg expressions would be better):
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
 *  XOOPS Admin Functions
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         kernel
 * @subpackage      XOOPS CP Functions
 * @since           2.0.0
 * @version         $Id: cp_header.php 3541 2009-08-31 23:02:37Z trabis $
 */

/**
 * module files can include this file for admin authorization
 * the file that will include this file must be located under xoops_url/modules/module_directory_name/admin_directory_name/
 */
$xoopsOption['pagetype'] = 'admin';
include_once 
dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR 'mainfile.php';
include_once 
$GLOBALS['xoops']->path('include/cp_functions.php');

$moduleperm_handler =& xoops_gethandler('groupperm');
if (
$xoopsUser) {
    
$url_arr explode('/'strstr($_SERVER['REQUEST_URI'], '/modules/'));
    
$module_handler =& xoops_gethandler('module');
    
$xoopsModule =& $module_handler->getByDirname($url_arr[2]);
    unset(
$url_arr);
    if (!
$moduleperm_handler->checkRight('module_admin'$xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
        
redirect_header(XOOPS_URL1_NOPERM);
        exit();
    }
} else {
    
redirect_header(XOOPS_URL '/user.php'1_NOPERM);
    exit();
}

//START OF HACK
$denny = array (
    
'/xoops_2.4.0/modules/news/admin/index.php?op=export',
    
'/xoops_2.4.0/modules/news/admin/index.php?op=configurenewsletter'
    
);
if (
$xoopsUser->getVar('uid') != && in_array($_SERVER['REQUEST_URI'], $denny)) {
    
redirect_header(XOOPS_URL '/admin.php'1_NOPERM);
    exit();
}
//END OF HACK

// set config values for this module
if ($xoopsModule->getVar('hasconfig') == || $xoopsModule->getVar('hascomments') == 1) {
    
$config_handler =& xoops_gethandler('config');
    
$xoopsModuleConfig $config_handler->getConfigsByCat(0$xoopsModule->getVar('mid'));
}

// include the default language file for the admin interface
if (file_exists($file $GLOBALS['xoops']->path('modules/' $xoopsModule->getVar('dirname') . '/language/' $xoopsConfig['language'] . '/admin.php'))) {
    include_once 
$file;
} else if (
file_exists($file $GLOBALS['xoops']->path('modules/' $xoopsModule->getVar('dirname') . '/language/english/admin.php'))) {
    include_once 
$file;
}
// I will disable this because module developer should nod be forced to have a admin.php
// xoops_loadLanguage('admin', $xoopsModule->getVar('dirname'));
?>

3
Burning
Re: Gui theme per user ?
  • 2009/12/17 0:37

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


Woah ... so simple. I'm a happy man now !

Obregado !!


Edit : topic title edited by me, solved.

Login

Who's Online

174 user(s) are online (129 user(s) are browsing Support Forums)


Members: 0


Guests: 174


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits