Results 1 to 5 of 5

Thread: dca tl_member.php

  1. #1
    User
    Join Date
    05-02-10.
    Posts
    121

    Default dca tl_member.php

    Code:
    'label' => array
    		(
    			'fields'                  => array('firstname', 'lastname', 'username'),
    			'format'                  => '%s %s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>',
    how for username = admin make this

    <span style="color:red;">admin</span>

    for example,
    'format' => ''.$myuname = %s. ($myuname == admin) ... .'', :D
    sorry for my english

  2. #2
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: dca tl_member.php

    I think you'll need to use a label_callback (instead of format) to do this.

    Code:
    'label' => array
          (
             'fields'                  => array('firstname', 'lastname', 'username'),
             'label_callback'          => array('tl_whatever', 'labelformat')
    Code:
    	public function labelformat($row, $label)
    	{
    
                   //whatever
    
    	return $label;
    	}

  3. #3
    User
    Join Date
    05-02-10.
    Posts
    121

    Default Re: dca tl_member.php

    thanks for the answer

    Code:
     public function labelformat($row, $label)
       {
    
                   $label = $this->fields->username;
    
       return $label;
       }
    how to call a username?
    $this->Member->username
    $this->username
    $GLOBALS['TL_DCA']['tl_member']['fields']['username']

    how?
    sorry for my english

  4. #4
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: dca tl_member.php

    $row is passed into the function, so $row['username'] should work.

    Code:
    if(//whatever)
    {
    $user = '<span style="color:red;">' .$row['username'] . '</span>';
    }else
    {
    $user = $row['username'];
    }
    
    //style label to suit
    $label =
    '<div class="limit_height h190 block">
    ' .$user .'
    </div>';
    
    return $label;
    I'm not sure how you determine if user is admin (there might be an isAdmin???)
    You can do imports, database calls and anything else you need to within the callback function.

  5. #5
    User
    Join Date
    05-02-10.
    Posts
    121

    Default Re: dca tl_member.php

    thanks!
    works!

    member admin = $row['username'] == 'admin'
    thats all

    other checks do not need
    this is only to highlight in BE
    sorry for my english

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
  •