Results 1 to 3 of 3

Thread: dcaconfig: backend changes for non-admins only

  1. #1
    User
    Join Date
    06-19-09.
    Posts
    106

    Default dcaconfig: backend changes for non-admins only

    Hi,


    From what I've seen this code can be used for instructions that apply to backend users that are non-admins:

    Code:
    if( !$this->User->isAdmin ) { ... }
    Maybe I've understood it wrong (I'm not really a programmer), but it seems that the cose then applies to all users, also admins. For example, the following code deletes the 'List' element from the Element type drop-down:

    Code:
    if( !$this->User->isAdmin )
    {
    unset($GLOBALS['TL_CTE']['texts']['list'])
    }
    Nut this applies to all users, admins and non-admins. How can I target only regular backend users (either who are part of a particular User Group, or who are simply not admins)?

    Many thanks!

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Your code is correct for non admins only but you have to import the BackendUser class first.

    PHP Code:
    /** system/config/dcaconfig.php */

    // Change some things for non admins
    $this->import('BackendUser''User');
    if(!
    $this->User->isAdmin)
    {
      unset(
    $GLOBALS['TL_CTE']['texts']['list']);
    }
    /** */ 
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3
    User
    Join Date
    06-19-09.
    Posts
    106

    Default

    Works perfectly!

    Thank you so much.

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
  •