Ok, I changed the event to OnWebPageComplete which creates the page... I created a link to that page so the user can navigate to that page which has a thankyou message on it. Couple things that may be of concern are.
How to stop multiple page creation if the user clicks back in the browser
Is there a way to put an error report in if the page is not created?
How to only allow access to the link once so the user can no longer see the link after a successful page creation (see idea below).
I thought about the child count idea but how to specify the count by createdby ID? How do I add the ability to have &createdby=`[[AuthorID]]` to that snippet? I already created a snippet to get the author ID of a particular document but how to add the &createdby param to the snippet below? If I can get the count to show the count for a given createdby ID I can then use Phx to control if the link is visible to the user if the count is greater than 1.
// initialize and get the number of children for a particular parent
$childCount = 0;
if ($children = $modx->getChildIds($parent, $depth)) {
$childCount = count($children);
}
// do something with $childCount or just return it
return $childCount;
Thanks!
I just thought of another addition that may work?
In the plugin I could have a statement to check a parent, then check the child docs. If the child doc count for createdby ID -20 <= 1 then carry on with the plugin, else warn the page is already created? Still learning lol.