Haven't looked at the other thread but a simple create resource from a snippet hook can be as follows:
[ed. note: lkfranklin last edited this post 10 months, 1 week ago.]
// Create a new resource
$newResource = $modx->newObject('modDocument');
// Set resources properties
$newResource->set('pagetitle', 'New Resource');
■ email: email@example.com | ■ website: https://alienbuild.uk
The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk
about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
There are a few advantages of NewsPublisher over doing it yourself with simple code:
1. Security -- NP does some serious sanitizing of all user input before writing anything to the DB
2. NP calls the Resource/Create processor, so any plugins will fire (e.g. defaultResourceGroup)
3. Easier to configure and change which fields show up in the form
4. Easier integration of TVs
5. Built-in Editing solution with EditThisButton.