Results 1 to 7 of 7

Thread: Give all users the same hompages

  1. #1
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Give all users the same hompages

    Hi,

    In my Home I have set up three pages each with different dashlets showing relevant infomation. The problem is the I want a way to make all my users all my users have this Hompage when they log in. How can this be done.

    I would be a great feature because I will have over 200 users and creating the new pages and dashlets for all of them will be time consuming.

    I am using Sugar 5.0.0i Pro

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  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: Give all users the same hompages

    You just have to create the file custom/modules/Home/dashlets.php containing the homepage definition.
    Even a new user log in the system his home page will be rendered according to this configuration.

    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
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Give all users the same hompages

    Thanks,

    But for the users I have already created and that have the correct set of pages and dashlet is this file somewhere that can be copied for only soem users, I will have for example this set of pages in home with dashlet say for all Accountants then for other users in different deparments I will have to create a different set of pages and dashlets.

    Can I copy something stored in the DB for example from one correct user to the other users I want to set the same home for.

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  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: Give all users the same hompages

    Hi Chris

    Let me know if I got it.
    You want to customize the sugar the way a specific set of users gets his homepage according to this dashlet configuration.

    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.

  5. #5
    chrislynch8's Avatar
    chrislynch8 is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Cork, Ireland
    Posts
    747

    Default Re: Give all users the same hompages

    This should explain it better.

    For all our Accountants 150+ when they press on home the tabs available instead for the default (My Sugar, Sales and Marketing, etc..) Will be


    Dairy - this will include the dashlets for there meeting, tasks, calls, missed calls,

    Accounts (WIP) - this is the work in prgress page it has five dashlets showing there Accounts based on differnet status values.

    Tax Returns - This has custom dashlet for a custom module that we use to keep track of all Tax Returns to be submitted, that have been submitted.


    So each time I activate a new Accountants user, I have to delete/modify the default sugar pages and match what we want.

    In the DB there is a user preference table, is it possible to copy the user preference form one user to others? Or is there something else I can do or do I just continue it manually..

    Hope this helps, if not let me know and I can proviede screenshots..

    Rgds
    Chris
    Linkedin Profile:Chris Lynch

    FDC IT Solutions
    FDC House
    Wellington Road
    Cork
    Ireland

  6. #6
    wichard is offline Sugar Community Member
    Join Date
    Dec 2004
    Location
    Almelo, Netherlands
    Posts
    75

    Default Re: Give all users the same hompages

    I haven't tried this but I think you can use this code to update how the dashlets are set.

    1. Retrieve settings from a user that is setup as you want the dashlets to be be setup for the other users.


    set $templateuser_user to the correct user.

    PHP Code:
                $pages $templateuser_user->getPreference('pages'$this->type); 
                
    $dashlets $templateuser_user->getPreference('dashlets'$this->type); 
    2. loop through target users, write the retrieved $templateuser_user settings to the target users

    PHP Code:
                $target_user->setPreference('dashlets'$dashlets0$this->type);
                
    $target->setPreference('pages'$pages0$this->type); 
    As I said, I haven't tried it but I think this will work

    look at /include/MySugar/MySugar.php for some dashlet / user_settings handling code
    Last edited by wichard; 2009-06-26 at 10:51 PM. Reason: typo
    Wichard Noppert
    Prudento
    Twitter

  7. #7
    dhavaldarji's Avatar
    dhavaldarji is offline Sugar Community Member
    Join Date
    Mar 2012
    Location
    Ahmedabad, Gujarat, India
    Posts
    20

    Default Re: Give all users the same hompages

    Quote Originally Posted by wichard View Post
    I haven't tried this but I think you can use this code to update how the dashlets are set.

    1. Retrieve settings from a user that is setup as you want the dashlets to be be setup for the other users.


    set $templateuser_user to the correct user.

    PHP Code:
                $pages $templateuser_user->getPreference('pages'$this->type); 
                
    $dashlets $templateuser_user->getPreference('dashlets'$this->type); 
    2. loop through target users, write the retrieved $templateuser_user settings to the target users

    PHP Code:
                $target_user->setPreference('dashlets'$dashlets0$this->type);
                
    $target->setPreference('pages'$pages0$this->type); 
    As I said, I haven't tried it but I think this will work

    look at /include/MySugar/MySugar.php for some dashlet / user_settings handling code
    i am trying to create a functionality to assign dashlets to a role , let say add My lead dashlet to visible list for users belonging to this role, so the My Lead dashlet will be visible to user of this role.
    i am successful in removing the dashlet from add dashlet-dialogue but can not remove the dashlet from users' home page across multiple page tab.

    so i wrote the belowe code in modules/ACLRoles/Save.php to get - reset - update users' page and dashlet preference.
    I tried this solution like...
    Code:
    $dashletClass='';
    foreach($dashletListData as $key => $val){
        if($val['access']==0)
            $dashletClass[] =  $key ;
    }
    
    $user_list=ACLRole::getRoleUsers($_REQUEST['record']);
    foreach($user_list as $key=>$val){
        //Create user object to work with
        $user = new User();
        $user->retrieve($val);
        
        //Fetch Preference for user
        $pages = $user->getPreference('pages', 'Home');
        $dashlets = $user->getPreference('dashlets','Home');
        $dashlet_temp = $dashlets;
        
        foreach($dashlet_temp as $key => $val){
            if(in_array($val['className'],$dashletClass)){
                unset($dashlet_temp[$key]);
            }
        }
        $user->setPreference('dashlets', $dashlet_temp, 0, 'Home');
        
        foreach($dashlets as $id=>$class){
            if(in_array($class['className'], $dashletClass))
                    $dashlet_name_id[$class['className']] = $id;
        }
        foreach($pages as $page_no => $columns){
        $newColumns[$page_no] = $pages[$page_no]['columns'];
        foreach ($newColumns[$page_no] as $col => $column) {
            foreach($column['dashlets'] as $key => $dashlet){
                 if(array_search($dashlet,$dashlet_name_id)){
                    unset($newColumns[$page_no][$col]['dashlets'][$key]);
                    }
                }
            }
        $pages[$page_no]['columns'] = $newColumns[$page_no];
        }
        $user->setPreference('pages', $pages, 0, 'Home');
    may be this saves the users' preference , but when this preference is fetched in modules/Home/index.php
    Code:
    // build dashlet cache file if not found
    if (!is_file($GLOBALS['sugar_config']['cache_dir'] . 'dashlets/dashlets.php')) {
        require_once('include/Dashlets/DashletCacheBuilder.php');
    
        $dc = new DashletCacheBuilder();
        $dc->buildCache();
    }
    require_once($GLOBALS['sugar_config']['cache_dir'] . 'dashlets/dashlets.php');
    
    require('modules/Home/dashlets.php');
    
    $pages = $current_user->getPreference('pages', 'Home');
    $dashlets = $current_user->getPreference('dashlets', 'Home');
    
    $defaultHomepage = false;

    This fetched the original old preference of user and displays all the dashlets those were added previously.

    i am using sugar 6.1.

    Thanks,
    Dhaval darji
    Attached Images Attached Images  

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 2009-06-15, 03:21 PM
  2. Just about to give up
    By MarkWoods in forum Help
    Replies: 10
    Last Post: 2009-04-07, 05:17 PM
  3. OK, I give up again
    By kbrill in forum Developer Help
    Replies: 0
    Last Post: 2006-08-13, 07:24 PM
  4. Nearly ready to give up
    By KoldFuzun in forum Help
    Replies: 4
    Last Post: 2006-07-04, 03:18 AM
  5. Just about to give up
    By kbrill in forum Developer Help
    Replies: 9
    Last Post: 2005-11-02, 06:07 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
  •