I am using ditto to retrieve document values (username, editedon, editedby, etc.). I am not receiving the correct username after updating a document with the docmanager api. Below is the snippet that I am using (function) that processes fields submitted through a form. I have validated that the snippet below updates the editedby value; however, the ditto call does not retrieve the appropriate username. I am using an uncached ditto call [! ditto !]
Is there an issue with just updating the editedby value on the document?
<?php
function editFormDoc( &$fields )
{
// Bring needed resources into scope
global $modx, $table_prefix;
require_once(’assets/libs/docmanager/document.class.inc.php’);
$id=$modx->documentObject[’id’];
$userID=$modx->getLoginUserID();
$title=$fields[pagetitle];
$projectDesc=$fields[projectDescription];
$projectBud=$fields[projectBudget];
$buildingName=$fields[buildingName];
$doc = new Document($id,’editedby,pagetitle’);
$doc->Set(’editedby’,$userID);
$doc->Set(’pagetitle’,$title);
$doc->Set(’tvprojectDescription’,$projectDesc);
$doc->Set(’tvprojectBudget’,$projectBud);
$doc->Set(’tvbuildingName’,$buildingName);
$doc->Save();
return true;
}
// Return empty string
return ’’;
?>