[pmwiki-users] EnableDrafts and PmForm

Petko Yotov 5ko at 5ko.fr
Wed Nov 12 12:46:51 CST 2014


I reviewed it and I will add a hook to allow loading of draft.php for 
actions other than 'edit', see:

   http://www.pmwiki.org/wiki/PmWiki/EditVariables#DraftActionsPattern

You can get the pre-release at pmwiki.org/Subversion (svn or zip; only 
draft.php changed) then in your template, use something like this:

(:input submit post Save:)
(:if auth admin:)
(:input submit postdraft "Save draft":)
(:else:)
(:input hidden postdraft 1:)
(:if:)

This way, regular editors pressing "Save" will save to the draft page, 
and administrators will save to the real page; admins will see an 
additional "Save draft" button if they want to re-save the draft page.

Petko

On 04.11.2014 02:25, Criss Ittermann wrote:
> I finally got to try it out, and the hidden field didn't behave as
> desired. In fact, I'm not sure anything happened at all.
> 
> Would the first example you gave cause problems for another pmform,
> such as one that sends emails?
> 
> Crisses
> 
> On Oct 22, 2014, at 12:09 PM, Petko Yotov <5ko at 5ko.fr> wrote:
> 
>> The current implementation could be changed to require Publish
>> permissions when Drafts are enabled but it would require a password
>> for the data page _before_ trying to save the draft version:
>> 
>> if ($_REQUEST['action'] == 'pmform')
>> $HandleAuth['edit'] = 'publish';
>> 
>> Instead, try adding a hidden field inside your pmform template,
>> something like:
>> 
>> (:input hidden postdraft 1:)
>> 
>> This should cause the post to be considered as if the user had
>> pressed the "Save draft" button while editing the page, so the Draft
>> page will be filled. (Unless I don't quite understand what you're
>> trying to do.)
>> 
>> Petko
>> 
>> On 22.10.2014 12:24, Criss Ittermann wrote:
>> 
>>> When a PmForm writes to another page, it doesn't respect the
>>> $EnableDrafts and $EnablePublishAttr features.
>>> Is there a way to require a PmForm respect these settings?
>>> We have 2 levels of author: admins & members. When a member uses a
>>> PmForm to change their profile, it should be approved by an admin
>>> before going public. I'm using the drafts system but member data
>>> is
>>> being stored in a "secret data area".
>> 
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list