Haven't looked at the other thread but a simple create resource from a snippet hook can be as follows:
<?php
// Create a new resource
$newResource = $modx->newObject('modDocument');
// Set resources properties
$newResource->set('pagetitle', 'New Resource');
$newResource->set('published', '1');
$newResource->set('template', '1');
$newResource->save();
return true;
[ed. note: lkfranklin last edited this post 6 years, 5 months ago.]
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.