1

We're using Guest Entries for comments. When the user posts an entry it automatically appears as a published entry. I'd like to change this functionality so that the entry will enter as a draft until approved.

I've set the user's permissions to "edit entry" but that doesn't seem to do the trick.

Any help would be appreciated.

3

Edited based on comment below

No sorry I see what you mean now. But I think with entry drafts you need to have first published an entry, then you create a draft from that entry, essentially creating two versions of the same one.

I think for approving entries as comments this is going to lead to a lot of complexity and you might struggle to get the results you want, and to do this the way you want would probably require writing your own plugin...

This plugin would listen to when an entry is saved, get that new entry id, create a new EntryDraftModel and then save it via craft()->entryRevisions->saveDraft() method. You would then need to set your new entry to disabled anyway (to stop it from showing) as creating a draft won't affect the newly created entry.

Then to approve an entry you would go into the newly created entry, switch to the draft (which would most likely be the same) and then apply it and enable the entry.

This is a complex process when your entire workflow could be condensed to:

  1. Create a new entry as disabled
  2. Enable an entry to approve it

Setting all new entries to disabled and then setting ones to active you want to approve will make your life easier and keep your build streamlined.

I don't think there is extensive info about drafts in particular but it might be worth checking the docs but essentially they are intended for entry revisions, not so much approving whole entries.

So...you can set entries to be disabled when they are submitted from within the guest entries plugin itself:

enter image description here

Just make sure the light switch is off for the correct section and entries wont be published. Then you will be able to set them to enabled as part of your approval process.

Doing this with a standard entry form

If you wanted to do this using crafts native entry form (with a logged in user), you would need to set the status at a template level

// entry form ...
<input type="hidden" name="enabled" value="0">

But a quick test revealed this didn't have any effect when using the guest entries plugin.

  • Is disabled and Draft really the same? – MISC Jul 18 '15 at 18:57
  • A disabled entry seems to be in the entries table with a postDate value of NULL while a draft entry seems to be in the table entrydrafts. – MISC Jul 18 '15 at 20:27
  • I've updated my answer to give a bit more information, hope it helps! – Alec Ritson Jul 18 '15 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.