Results 1 to 7 of 7

Thread: How are user preferences for Tabs stored?

  1. #1
    jollyguy77 is offline Member
    Join Date
    Nov 2009
    Posts
    18

    Default How are user preferences for Tabs stored?

    Hi,

    I am new to SugarCRM and we are using Open source. I would like to know the following

    1) How are user's preferences for Displaying stored? and where are they stored?
    2) How does the tabs are displayed? Is there a common code where it will check for user's preferences and then get displayed accordingly? For example.. i may want to Hide "Lead" for all the users except for some users... How to go about it.

    Please help me out..

    Thanks in advance..

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: How are user preferences for Tabs stored?

    To enable only a specific set of users to access some tabs you need to create some Roles and disable/enable access to these modules. Add some users under these Roles.
    The order of tabs to be displayed is stored into table config:
    name: MySettings
    category: tabs

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    jollyguy77 is offline Member
    Join Date
    Nov 2009
    Posts
    18

    Default Re: How are user preferences for Tabs stored?

    Quote Originally Posted by andopes View Post
    To enable only a specific set of users to access some tabs you need to create some Roles and disable/enable access to these modules. Add some users under these Roles.
    The order of tabs to be displayed is stored into table config:
    name: MySettings
    category: tabs

    Cheers
    Hi,

    Where can i find the above table config?. While creating a roles i am not able to see the "My Portal". I want to disable the "My Portal" for non-admin users. Once i disable it, when i click on a User Portal, it is showing the error as "Warning: You do not have permission to access this module.". Once i enable the "My portal" for non-admin users, then there is no error message and the User Portal can be viewn. I have declared the User portal as Global. Is there a way to overcome this... That is why i thought while getting the list of modules name to be displayed, i can check if the user is admin or not. if it is not then hide the "My Portal" in the Tabs list.. but show the rest of the tabs.. Can u please help me out?

    Thanks...

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: How are user preferences for Tabs stored?

    Already answered in another thread.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    AntonioCS is offline Member
    Join Date
    Nov 2009
    Posts
    8

    Default Re: How are user preferences for Tabs stored?

    So how about posting a link to where it was answered....

  6. #6
    rajaseeth is offline Senior Member
    Join Date
    Sep 2009
    Posts
    31

    Default Re: How are user preferences for Tabs stored?

    Hi,

    I have solved my problem by not showing "My Portal" for Non-admin users and still show the Portals that has been added.. I did it by changing in the themes\sugar\header.php. since i am using only 1 theme.(LINE NO: 519 or so..Search for the '$preListHeader as $module_name')

    OLD CODE:
    Code:
    foreach($preListHeader as $module_name)
        {
                if (!is_array($module_name)) {
                $xtpl->assign("MODULE_NAME", $app_list_strings['moduleList'][$module_name]);
                $xtpl->assign("MODULE_KEY", $module_name);
    
    
                if($module_name == $currentModule && ($module_name != 'iFrames' || empty($_REQUEST['record'])|| (!empty($_REQUEST['tab']) && $_REQUEST['tab']=='false')))
                {
                    $tabClass = "currentTab";
                    $otherTab = "currentTab";
                    $xtpl->assign("TAB_CLASS", "currentTab");
                    $xtpl->assign("OTHER_TAB", "currentTab");
                }
                else
                {
                    $tabClass = "otherTab";
                    $otherTab = "currentTab";
                    $xtpl->assign("TAB_CLASS", "otherTab");
                    $xtpl->assign("OTHER_TAB", "currentTab");
                }
                $xtpl->assign("LINK", '<a   class="'.$tabClass.'Link"  href="index.php?module='.$module_name.'&action=index">'.$app_list_strings['moduleList'][$module_name].'</A>');
                } else {
    
                $xtpl->assign("MODULE_NAME", $module_name[4]);
                $xtpl->assign("MODULE_KEY", $module_name[3]);
    
    
                if($module_name[3] == $currentModule && (!empty($_REQUEST['record']) and $_REQUEST['record']==$module_name[0] and !empty($_REQUEST['tab'])))
                {
                    $tabClass = "currentTab";
                    $otherTab = "currentTab";
                    $xtpl->assign("TAB_CLASS", "currentTab");
                    $xtpl->assign("OTHER_TAB", "currentTab");
                }
                else
                {
                    $tabClass = "otherTab";
                    $otherTab = "currentTab";
                    $xtpl->assign("TAB_CLASS", "otherTab");
                    $xtpl->assign("OTHER_TAB", "currentTab");
                }
                $xtpl->assign("LINK", '<a   class="'.$tabClass.'Link"  href="index.php?module='.$module_name[3].'&action=index&record='.$module_name[0].'&tab='.$module_name[2].'">'.$module_name[4].'</A>');
    
                }
    
                if ($i==$max_tabs-1 and $numb_tabs>$max_tabs) {
                    //$xtpl->assign("MORE", "<img src='".$image_path."more.gif' alt='' align='absmiddle' id='MoreHandle' style=' margin-left:2px; cursor: pointer; cursor: hand;' align='absmiddle' onmouseover='tbButtonMouseOver(this.id,\"\",\"\",0);'>");
                    $xtpl->assign("MORE_HANDLE_CLASS", 'otherTab');
                    $xtpl->parse("main.moreHandle");
                }
                $xtpl->parse("main.module_tab");
            $i++;
        }
    NEW CODE: // This is the section where modules are added to the tabs list..
    Code:
    foreach($preListHeader as $module_name)
        {
                if (!is_array($module_name)) {
                if ($module_name != 'iFrames')
                {
                    $xtpl->assign("MODULE_NAME", $app_list_strings['moduleList'][$module_name]);
                    $xtpl->assign("MODULE_KEY", $module_name);
    
    
                    if($module_name == $currentModule && ($module_name != 'iFrames' || empty($_REQUEST['record'])|| (!empty($_REQUEST['tab']) && $_REQUEST['tab']=='false')))
                    {
                        $tabClass = "currentTab";
                        $otherTab = "currentTab";
                        $xtpl->assign("TAB_CLASS", "currentTab");
                        $xtpl->assign("OTHER_TAB", "currentTab");
                    }
                    else
                    {
                        $tabClass = "otherTab";
                        $otherTab = "currentTab";
                        $xtpl->assign("TAB_CLASS", "otherTab");
                        $xtpl->assign("OTHER_TAB", "currentTab");
                    }
                    $xtpl->assign("LINK", '<a   class="'.$tabClass.'Link"  href="index.php?module='.$module_name.'&action=index">'.$app_list_strings['moduleList'][$module_name].'</A>');
                }
                else
                { // Add "My Portal" to the Tabs only if the User is Admin..
                    if ($current_user->user_name == 'Admin')
                    {
                        $xtpl->assign("MODULE_NAME", $app_list_strings['moduleList'][$module_name]);
                        $xtpl->assign("MODULE_KEY", $module_name);
    
    
                        if($module_name == $currentModule && ($module_name != 'iFrames' || empty($_REQUEST['record'])|| (!empty($_REQUEST['tab']) && $_REQUEST['tab']=='false')))
                        {
                            $tabClass = "currentTab";
                            $otherTab = "currentTab";
                            $xtpl->assign("TAB_CLASS", "currentTab");
                            $xtpl->assign("OTHER_TAB", "currentTab");
                        }
                        else
                        {
                            $tabClass = "otherTab";
                            $otherTab = "currentTab";
                            $xtpl->assign("TAB_CLASS", "otherTab");
                            $xtpl->assign("OTHER_TAB", "currentTab");
                        }
                        $xtpl->assign("LINK", '<a   class="'.$tabClass.'Link"  href="index.php?module='.$module_name.'&action=index">'.$app_list_strings['moduleList'][$module_name].'</A>');
                    }
                    else
                    {
                        $xtpl->assign("MODULE_NAME", $app_list_strings['moduleList'][$module_name]);
                        $xtpl->assign("MODULE_KEY", $module_name);
                        $tabClass = "PortalTab";
                        $otherTab = "currentTab";
                        $xtpl->assign("TAB_CLASS", "PortalTab");
                        $xtpl->assign("OTHER_TAB", "currentTab");
                    }
                }
                } else {
    
                $xtpl->assign("MODULE_NAME", $module_name[4]);
                $xtpl->assign("MODULE_KEY", $module_name[3]);
    
    
                if($module_name[3] == $currentModule && (!empty($_REQUEST['record']) and $_REQUEST['record']==$module_name[0] and !empty($_REQUEST['tab'])))
                {
                    $tabClass = "currentTab";
                    $otherTab = "currentTab";
                    $xtpl->assign("TAB_CLASS", "currentTab");
                    $xtpl->assign("OTHER_TAB", "currentTab");
                }
                else
                {
                    $tabClass = "otherTab";
                    $otherTab = "currentTab";
                    $xtpl->assign("TAB_CLASS", "otherTab");
                    $xtpl->assign("OTHER_TAB", "currentTab");
                }
                $xtpl->assign("LINK", '<a   class="'.$tabClass.'Link"  href="index.php?module='.$module_name[3].'&action=index&record='.$module_name[0].'&tab='.$module_name[2].'">'.$module_name[4].'</A>');
    
                }
    
                if ($i==$max_tabs-1 and $numb_tabs>$max_tabs) {
                    //$xtpl->assign("MORE", "<img src='".$image_path."more.gif' alt='' align='absmiddle' id='MoreHandle' style=' margin-left:2px; cursor: pointer; cursor: hand;' align='absmiddle' onmouseover='tbButtonMouseOver(this.id,\"\",\"\",0);'>");
                    $xtpl->assign("MORE_HANDLE_CLASS", 'otherTab');
                    $xtpl->parse("main.moreHandle");
                }
                $xtpl->parse("main.module_tab");
            $i++;
        }
    in the style.css added the following style
    Code:
    .PortalTab {
            display:none;
            }
    .PortalTabRight , .PortalTabLeft, .PortalTab {
            display:none;
            }
    By using the above code i was able to hide "my Portal" and also at the same time show the Portals for all the users.


    Thanks
    Raja.

  7. #7
    monicaDC is offline Sugar Community Member
    Join Date
    Feb 2009
    Posts
    175

    Default Re: How are user preferences for Tabs stored?

    Thank you Raja. This was very helpful.
    Cheers,
    Monica

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Not able to save User preferences
    By skumar25dec in forum Help
    Replies: 3
    Last Post: 2009-07-03, 06:35 AM
  2. User preferences
    By jonnywatson in forum Help
    Replies: 11
    Last Post: 2008-07-15, 08:40 AM
  3. subpaneldefs.php versus user preferences.
    By arisjr in forum Developer Help
    Replies: 0
    Last Post: 2008-02-15, 10:07 AM
  4. User preferences not saved
    By dromin in forum Help
    Replies: 1
    Last Post: 2006-04-07, 12:41 PM
  5. 'Order by' and user preferences
    By rajubitter in forum Developer Help
    Replies: 2
    Last Post: 2005-07-29, 01:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •