//Simple snippet to return Author and time a document was created.
//Original code borrowed from MetaTag snippet by Miels, converted to MODX
//by Shane Briggs.
//AuthorTime snippet by Jason Tyler
$Author = "";
$docInfo = $modx->getDocument($modx->documentIdentifier);
// *** AUTHOR,Time***
$authorid = $docInfo['createdby'];
$createdon = date('d-M-y h:i:s A',$docInfo['createdon']);
$tbl = $modx->getFullTableName('user_attributes');
$query = "SELECT fullname FROM $tbl WHERE $tbl.id = $authorid";
$rs = $modx->dbQuery($query);
$limit = $modx->recordCount($rs);
if($limit=1) {
$resourceauthor = $etomite->fetchRow($rs);
$authorname = $resourceauthor['fullname'];
}
if (!$authorname == ""){
$Author = "By <strong>$authorname</strong> on $createdon " ;
}
// *** RETURN RESULTS ***
$output = $Author;
return $output;
$tbl = $modx->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix']."user_attributes";
$tbl = $modx->getFullTableName('user_attributes');[[AuthorTime? &dateFormat=`%d %B %Y - %H:%M` &usedDate=`pub_date` &tpl=`Posté par <strong>[+Author+]</strong> le [+Date+]`]]
This discussion is closed to further replies. Keep calm and carry on.