Need help with the styling comments

Hi!
I have in my template.php (custom theme) the following code to present a comments along with EDIT and DELETE Links:

function custome_comment_list_result_html($comments) {
  global $user;
  $user = user_load($user->uid);
  $result = '';
  
  foreach ($comments as $key => $value) {
    $postTime = format_date($value['data']['created'],'medium','H:i, d F, Y',NULL,NULL);
    
    $result .= '
'; $result .= '
'; $result .= $value['data']['pic']; $result .= '
'; $result .= '
'; $result .= '
'.$value['data']['name']; $result .= '
'.$postTime.'
'; $result .= '
'; if (($user->uid == $comment->uid && user_access('edit own comments')) || user_access('administer comments')) { $result .= '
'.$value['data']['body'].'
'; $result .= '
'; $result .= '
Изменить
'; $result .= '
Удалить
'; $result .= '
'; }else{ $result .= '
'.$value['data']['body'].'
'; $result .= '
'; } $result .= '
';

But if the

user_access('administer comments')

permission works perfectly, the following code

($user->uid == $comment->uid && user_access('edit own comments'))

does not work and I can’t see, where the fault is. Please, can you help me?

Sincerely, Svetlana

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/3/feed