Hi, just engaged myself with the NewsPublisher. In the standard call you have to set a parent folder where you want to post the document. This is not very flexible if you have several News/Blog categories. Instead of setting up a NewsPublish call for every category (folder), I wanted a more usable solution. And here it is:
First, create a plugin "referer" with this content:
$_SESSION['referrer']= $modx->documentObject['id'];
and activate it for the system event "OnLoadWebDocument".
Then create a snippet "referer" with this content:
$output = $modx->getParent($_SESSION['referrer'],1,'id');
return $output['id'];
Create a document "Publish News" (or similar), restricted to the web user group which should be able to publish and put in the NewsPublish call: (for example):
[!NewsPublisher? &folder=`[!referer!]` &canpost=`blog admin` &formtpl=`blogform` &=`tvblogcontent`!]
How to set up newspublisher is described
here, thanks to Jason for
this hint.
What it does:
If you want to publish directly from your site, just surf to a document in the category where you want to publish a new one. If you have the permission to post a new entry, you should see the menu entry "Publish News" from above in the menu. If you click that, the form for a new entry is shown and automatically set to the category from where you hit the menu entry "Publish News".
Example:
You have a news section with 5 categories: Hardware, Software, CMS, PHP, AJAX. You want your news authors not to enter the manager and want to use the NewsPublisher. But you don´t want to create five calls for the NewsPublisher for every category. So use the solution above. The author who for example wants to publish in "CMS" only has to surf to a news entry in the category "CMS". Then click on "Publish News" and it will automatically show the form for the entry and will save it in the category "CMS".
How it works:
The plugin writes the actual document id in the _session array. The snippet reads this and gives back the parent of the id of the referer page. This is used to call the NewsPublisher snippet and give it the parent id of the referred document.
Hope this is understandable
Regards,
Marc