discuss.answer
The button will show on any page that uses the template when the user has edit_document and save_document permissions in general, and save permission for the current resource.
If you'd like to show it only on the user's own pages, you can just add this code around line 60 of the NpEditThisButtonSnippet:
if ($modx->resource->get('createdby') !== $modx->user->get('id')) {
return '';
}
Nice. Thanks, Bob.
Any chance this could somehow be included as an option in the add-on? Just so it won't get overwritten if/when NP is updated.
Todd
Yes, but it will be disabled, so you'll still have to enable it by using the appropriate property.
That sounds good. Thanks.
Todd
It's available here now (not quite in the form you have) if you want a head start:
https://raw.githubusercontent.com/BobRay/newspublisher/dev/core/components/newspublisher/elements/snippets/npeditthisbutton.snippet.php
Just paste the code there into the NpEditThisButton snippet and add &ownpagesonly=`1` to the button tag.
The updated snippet doesn't work the same way as manually adding your previous 3 lines of code to the NpEditThisButton snippet.
Todd
No it doesn't. Did you add the property to the button tag?
Yep, the property has been added.
With the new snippet the edit button is visible to all users. When I switch back to your previous code it works as expected.
Todd
The changes in the snippet didn't get propagated to GitHub for some reason. Try that GitHub link again and re-paste. The code is changed.