Turn "module menu filters" off for new users!

Hi guys,

I just installed SuiteCRM and am trying to figure out which settings we need.
One annoying thing is, that I have to turn off “module menu filters” for each new user manually.
Since we just use modules as navigation tabs, there is no need to group them. However, they still show up by default for each new registered user.

How do I turn them off by default? It’s probably only “1” that needs to turned into a “0” in a php-file… Unfortunately I don’t know nothing (about php)…

Would appreciate all clues you can give me!

Admin > Configure Menu filters

Here you can delete the filters

Hope this helps :slight_smile:

Deleting the filters just removes the groups from the menu, you’re then just left with “All” menu, each user still needs to go in and disable module menu filters.

Is there a way to do that for all users?

It’s in the “user_preferences” table in the database, in a row with the user_id and category set as “global”.

Grab the “contents” field, decode it with Base64.

(you can try it manually here https://www.base64decode.org/)

It’s a preference called “navigation_paradigm”

Value should be “gm” when it’s on, “m” when it’s off

Example of the relevant section:

s:19:"navigation_paradigm";s:2:"gm"

If you want a quick hack that is non-upgrade-safe, and works only for newly created users, change the value here

https://github.com/salesagility/SuiteCRM/blob/master/include/utils.php#L379

Think I’ll just tell all my users they have to turn it off in profile.

Thanks

This keeps coming up, sometimes about one preference, sometimes about another. Understandably, people are wary to do the changes this way this due to the complexity.

We (the Community) should make up a script to do these sweeping changes to all users. It is really not that hard in PHP, all those preferences load directly into an array, in one single command. We can use the current code that loads preferences.

I would do this in an hour or two, but this is really not a good time for me now, I have too much on my hands…

1 Like

I have searched the entire distribution for the string: “navigation_paradigm”

It appears in the following files:
. config.php: here it essentially does:

$sugar_config['default_navigation_paradigm'] = 'gm';

. include/utils.php
In this file it appears in two places.
a. Within the function

function make_sugar_config(&$sugar_config)

it does:

        'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm,

Since $navigation_paradigm is not global and not referred to anywhere else in the function it always defaults to ‘gm’!!!

By the way: I assume there is a bug here because in the first part of the function there is a list of global variables that are referred inside the function so the following line should be be missing in that list:

glogal $navigation_paradigm;

b. within the function

function get_sugar_config_defaults()

where it defaults to ‘gm’

. modules/Users/Save.php
Here it just saves it (I assume when modified via the user interface):

    if (isset($_POST['use_group_tabs'])) {
        $focus->setPreference('navigation_paradigm', $_POST['use_group_tabs'], 0, 'global');
    } else {
        $focus->setPreference('navigation_paradigm', 'gm', 0, 'global');
    }

.modules/Users/UserViewHelper.php

in the class UserViewHelper within the function:

    protected function setupAdvancedTabNavSettings()

in which it does:

        $useGroupTabs = $this->bean->getPreference('navigation_paradigm');
        if ( ! isset($useGroupTabs) ) {
            if ( ! isset($GLOBALS['sugar_config']['default_navigation_paradigm']) ) {
                $GLOBALS['sugar_config']['default_navigation_paradigm'] = 'gm';
            }
            $useGroupTabs = $GLOBALS['sugar_config']['default_navigation_paradigm'];
        }
        $this->ss->assign("USE_GROUP_TABS",($useGroupTabs=='gm')?'checked':'');

(in practice if not set at the user level it uses the global definition).

. include/MVC/View(SugarView.php
within the class SugarView, in the function

    public function displayHeader($retModTabs = false)

where it does:

        $useGroupTabs = $this->bean->getPreference('navigation_paradigm');
        if ( ! isset($useGroupTabs) ) {
            if ( ! isset($GLOBALS['sugar_config']['default_navigation_paradigm']) ) {
                $GLOBALS['sugar_config']['default_navigation_paradigm'] = 'gm';
            }
            $useGroupTabs = $GLOBALS['sugar_config']['default_navigation_paradigm'];
        }
        $this->ss->assign("USE_GROUP_TABS",($useGroupTabs=='gm')?'checked':'');

(it looks for it or assigns the default or ‘gm’ when no default is there)

In conclusion:

you could try adding the following lines in config_override.php:

$sugar_config['default_navigation_paradigm'] = 'm';

// the following line not only overrides the value but it overwrites it to a fixed value of 'm'.
$current_user->setPreference('navigation_paradigm', 'm', 0, 'global');

Note:
I haven’t tried this solution but I believe it should work and it should be upgrade safe.
If you try please post back your findings.
Maybe it’s better that you take a back-up of all your installation (both db and files) if you are planning to try on a non-test environment!

1 Like

While module menu filter is available to be set to a default value via config override, it would be a good solution if modules/Users/User.php had allowed similar default settings for the other options like Subpanel Tabs, Sort modules alphabetically and the Most Important of ALL, ability to SET default Display Modules for new users.

See this new tip

Check upgrade safe solution here:

Thanks,

Broz Technologies