Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: Change default Colour Scheme/layout/sub theme for all users?

Change default Colour Scheme/layout/sub theme for all users? 6 months 3 weeks ago #79651

  • balandar
  • balandar's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
I have a custom sub-theme for a suitecrm installation. Is it possible to change the default sub theme for all existing users or force all users to use a different theme (either through php scripts or mysql)?

Thanks
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 6 months 3 weeks ago #79658

  • Jamie_Langer
  • Jamie_Langer's Avatar
  • Offline
  • New Member
  • Posts: 1
  • Karma: 0
Any answer to this question would also help me as even I'm looking for a similar implementation.
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 6 months 3 weeks ago #79775

  • balandar
  • balandar's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
FYI, I found where the sub-theme is stored in the DB.
# SELECT contents FROM `user_preferences` WHERE category='global' ORDER BY `date_modified` DESC
# The contents field contains an md5 string which is a php array
# use unserialize(base64_decode('md5_string')); to get the array
# modify the subtheme key/value pair E.G. [subtheme] => Dawn
# base64_encode the array and serialize it. 
# Update the DB entry
# do a repair/build from admin center (I wonder if this can be done through cmd line or a curl function...?)

I haven't had the time to write the code and test my theory, but I think it will work. I'll report back when I try it.
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 6 months 2 weeks ago #79819

  • AlxGr
  • AlxGr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 408
  • Thank you received: 78
  • Karma: 17
Modify custom/themes/SuiteP/themedef.php
For example I'm using "Day" as default and disabled the "Dusk" and "Night" by commenting their lines:
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}

global $app_strings;

$themedef = array(
    'name' => 'Suite P',
    'description' => 'SuiteCRM Responsive Theme',
    'version' => array(
        'regex_matches' => array('.+'),
    ),
    'group_tabs' => true,
    'classic' => true,
    'configurable' => true,
    'config_options' => array(

        'display_sidebar' => array(
            'vname' => 'LBL_DISPLAY_SIDEBAR',
            'type' => 'bool',
            'default' => true,
        ),
        'sub_themes' => array(
            'vname' => 'LBL_SUBTHEME_OPTIONS',
            'type' => 'select',
            'default' => 'Day', //HERE GOES THE DEFAULT SUBTHEME
        ),
    ),
);

if(!empty($app_strings['LBL_SUBTHEMES'])) {
    // if statement removes the php notice
    $themedef['config_options']['sub_themes']['options'] = array(
        $app_strings['LBL_SUBTHEMES'] => array(
            'Dawn'  => $app_strings['LBL_SUBTHEME_OPTIONS_DAWN'],
            'Day'   => $app_strings['LBL_SUBTHEME_OPTIONS_DAY'],
            //'Dusk'  => $app_strings['LBL_SUBTHEME_OPTIONS_DUSK'], // DISABLED SUBTHEME
            //'Night' => $app_strings['LBL_SUBTHEME_OPTIONS_NIGHT'], // DISABLED SUBTHEME
        ),
    );
    $themedef['config_options']['sub_themes']['default'] = 'Day';   //HERE GOES THE DEFAULT SUBTHEME TOO
}

This will work with new users. Older users need to modify the profile to select the right subtheme under Layout options.

Thanks,
I can help you with your customization. Requests at ctmprogra @ ondsystems . com
No dude en contactarme si necesita personalizar su aplicación. Mi email es ctmprogra @ ondsystems . com
Last Edit: 6 months 2 weeks ago by AlxGr.
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 3 months 1 week ago #87028

  • bonsaiko
  • bonsaiko's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
I tested what you did and it seemed to work fine, except that when I reload my page, old theme is stil applied...
My css is all broken and I can't find any way to get it back.
I did repair and quick repair but it's still broken.
Could you please help me ?
I'm in a big stress now...
Thanks
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 3 months 1 week ago #87034

  • ashish@outrightcrm.com
  • ashish@outrightcrm.com's Avatar
  • Online
  • SuiteCRM Is My Life
  • CTO at outright Systems
  • Posts: 447
  • Thank you received: 53
  • Karma: 5
You may have a look at this plugin ..

store.outrightcrm.com/product/suitecrm-theme-style-builder/
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 3 months 1 week ago #87040

  • bonsaiko
  • bonsaiko's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Thanks for your answer but for now that's not what I'm looking for.
I was able to create my own theme and subtheme.
However for some reason when I look at the html code, it seems the page tries to load the older css (SuiteP) instead of mine.
And for some reason, this theme doesn't load...

Actually I had a closer look and what happens is :
it tries to load my theme and subtheme from cache, but it seems nothing is in the cache...
I don't understand why.
How is that the css is not in cache ?
The administrator has disabled public write access.

Change default Colour Scheme/layout/sub theme for all users? 3 months 1 week ago #87041

  • bonsaiko
  • bonsaiko's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Finally i understood :
The css file WAS in the cache folder.
My issue was a problem of file permissions.
I renwed file permissions on cache folder recursively and it's ok now :)
The administrator has disabled public write access.
Time to create page: 0.046 seconds
Powered by Kunena Forum