Results 1 to 5 of 5

Thread: hide commands button for specify users

  1. #1
    paolomaiok is offline Member
    Join Date
    Mar 2009
    Posts
    19

    Default hide commands button for specify users

    Hello,I need to hide some commands buttons in campains module,but only for users(not admin).

    I find in forum the code to do it but I don't find where to put it.The code is this :

    function is_AuditEnabled(){
    //return false;
    global $current_user;
    if(!is_admin($current_user) ){ //&& $_REQUEST['action'] == 'DetailView'
    return false;
    }
    return parent::is_AuditEnabled();;
    }

    if($this->is_AuditEnabled()){.....


    Now the question is,where are the php pages for hide the buttons showed in the image ?Tnks in advance for the help,bye




    Uploaded with ImageShack.us

    Paolo

  2. #2
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: hide commands button for specify users

    Hi,

    Add following code in your custom/modules/Campaigns/metadata/detailviewdefs.php

    PHP Code:
    global $current_user;
    if(!
    $current_user->is_admin)
    {
    $viewdefs['Campaigns']['DetailView']['templateMeta']['form']['links']
     = array(
             
    '<input type="button" class="button" onclick="javascript:window.location=\'index.php?module=Campaigns&action=TrackDetailView&record={$fields.id.value}\';" value="{$MOD.LBL_TRACK_BUTTON_LABEL}" />',
             
    '<input type="button" class="button" onclick="javascript:window.location=\'index.php?module=Campaigns&action=RoiDetailView&record={$fields.id.value}\';" value="{$MOD.LBL_TRACK_ROI_BUTTON_LABEL}" />',
            );
        

    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  3. #3
    paolomaiok is offline Member
    Join Date
    Mar 2009
    Posts
    19

    Default Re: hide commands button for specify users

    Tnks davidboris for the reply!
    With your code I hide the bottom button,and this is real good,but for the "edit" and "remove" in the tracker urls,how can I do?
    bye

    Paolo

  4. #4
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: hide commands button for specify users

    Hi,

    For your second query, you have to override the subpanel definition for Tracker URL and comment out lines written for edit and delete.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  5. #5
    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: hide commands button for specify users

    You need to copy the script modules/Campaigns/views/view.detail.php into custom/modules/Campaigns/views/view.detail.php and add into function display, before parent::display(); the following code, with some modification:

    if(! is_admin($current_user)) {
    unset($this->dv->defs['templateMeta']['form']['links'][0]);
    }

    This will removes the button "Launch Wizard".
    In order to conditionally deletes the two links at subpanel you need to modify the piece of code regarding subpanels on view.detail.php.

    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.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. hide the button
    By neel1154 in forum Developer Help
    Replies: 19
    Last Post: 2012-05-07, 11:23 AM
  2. hide edit button from listview
    By prasannagowri in forum Developer Help
    Replies: 6
    Last Post: 2011-04-04, 12:10 PM
  3. [HELP] Hide Delete button on ListView
    By rcastro in forum Developer Help
    Replies: 1
    Last Post: 2010-04-28, 01:34 PM
  4. Replies: 3
    Last Post: 2009-01-30, 07:52 AM
  5. Hide selection button
    By Ainfo in forum Help
    Replies: 4
    Last Post: 2008-10-31, 11:08 AM

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
  •