@dev_cw, sorry to keep switching. Using the same technic as above I’ve got the updated
main-news-TPL in the body of template News.
Basically the article was printing out the user
admin, and not the one I set it to via the Doc Manager => Set Authors,
demo. Weird thing is if I go back to my previous Ditto call the [+author+] displays is the correct one.
So I was looking at what was in the PHx snippet and noticed;
// Returns the specified field from the user record
// positive userid = manager, negative integer = webuser
thus thinking [+phx:userinfo=`-username`+] was how you used it, just sure how you specifiy the correct negative number.
Now I still can’t figure out why the author isn’t printing what I expect is there any way of ripping Ditto’s author output to use in PHx.
// set author placeholder
if (in_array("author",$this->fields["display"]["custom"])) {
$placeholders['author'] = $this->getAuthor($resource['createdby']);
}
// ---------------------------------------------------
// Function: getAuthor
// Get the author name, or if not available the username
// ---------------------------------------------------
function getAuthor($createdby) {
global $modx;
$user = false;
if ($createdby > 0) {
$user = $modx->getUserInfo($createdby);
} else {
$user = $modx->getWebUserInfo(abs($createdby));
}
if ($user === false) {
// get admin user name
$user = $modx->getUserInfo(1);
}
return ($user['fullname'] != "") ? $user['fullname'] : $user['username'];
}