<?php
$defaultavatar ='<img src="assets/images/avatars/defaultuser.gif" alt="Анонимен" border="0" />';
$output ='';
$tbl = $modx->dbConfig['table_prefix'];
$authorID = isset($authid) ? $authid : $modx->documentObject['createdby'];
$addutype ='';
if($authorID !='' && $authorID < 0){
$addutype ='web_';
}
if($authorID == 0){
$output .=$defaultavatar;
}else{
if($authorID != ''){
$authorID = str_replace('-','', $authorID);
$sql = "SELECT fullname,photo
FROM ".$tbl.$addutype."user_attributes
WHERE internalKey='".$authorID."'";
$rs = $this->dbQuery($sql);
$limit = $this->recordCount($rs);
if($limit > 0 && $limit < 2) {
$user = $this->fetchRow($rs);
if($user['photo'] != ''){
$modx->setPlaceholder('author_photo', '<img width="100" height="100" class="avatar" src="'.$user['photo'].'" alt="'.$user['fullname'].'" border="0" />'); // [+author_photo+]
}else{
$modx->setPlaceholder('author_photo', '<a href="#">'.$defaultavatar.'</a>');
}
$output .='[+author_photo+]';
}
}else{
$output .=$defaultavatar;
}
}
return $output;
?>