ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comments OFF by default for Safecracker submitted entries. How to turn on?

May 31, 2011 1:02am

Subscribe [3]
  • #1 / May 31, 2011 1:02am

    JohanD

    59 posts

    Hi All,

    I have a few safecracker forms, and the comments are off for the entries submitted using safecracker.  I haven’t been able to find how to sort this out; but how do I turn on comments for safecracker submitted entries by default?

    Thanks

    p.s. EE 2.1.5

  • #2 / May 31, 2011 12:16pm

    Kevin Smith

    4784 posts

    Hi JohanD—

    You could either add this field to your form (to allow the author to explicity choose to allow comments) or a hidden field variant of the same:

    <label class="checkbox"><input type="checkbox" name="allow_comments" value="y" {allow_comments} /> Allow Comments</label>

    Does that help solve your question?

    Kevin

  • #3 / Aug 15, 2011 11:56pm

    Ryan M.

    1511 posts

    I think this might be a bug. My Safecracker form is editing a channel where the Select ‘Allow Comments’ button in Publish page by default? preference is set to “Yes”. I loaded an entry in a Safecracker form whose Allow Comments checkbox is checked, and viewing source I see:

    <form id="publishForm" method="post" action="http://site.com/edit/something"  enctype="multipart/form-data" >
    <div class='hiddenFields'>
    <input type="hidden" name="ACT" value="321" />
    <input type="hidden" name="RET" value="http://site.com/edit/something" />
    <input type="hidden" name="URI" value="edit/something" />
    <input type="hidden" name="XID" value="e154f0a4047e67fbf4c885cf4713d6e401a1e" />
    <input type="hidden" name="return_url" value="edit/something" />
    <input type="hidden" name="author_id" value="4321" />
    <input type="hidden" name="channel_id" value="4" />
    <input type="hidden" name="entry_id" value="12345" />
    <input type="hidden" name="site_id" value="1" />
    <input type="hidden" name="return" value="edit/something" />
    <input type="hidden" name="preserve_checkboxes" value="yes" />
    <input type="hidden" name="allow_comments" value="n" />
    </div>

    Note the last line there. Even if my checkbox is checked in the CP, the hidden field automatically inserted here reads “n”. I have to explicity override that later with another hidden field:

    <input type="hidden" name="allow_comments" value="y" />

    towards the end of the form.

  • #4 / Aug 16, 2011 12:38pm

    Andrea DeMers

    18 posts

    I’m experiencing the same issue as described above by Ryan.

    When I publish an entry via the Control Panel, comments are enabled as per the Channel Preferences settings.

    EE v2.2.2 - Build: date 20110801

  • #5 / Aug 18, 2011 12:27pm

    Kevin Smith

    4784 posts

    Ryan and Andrea, while I work on trying to confirm this as a bug and report it, can either of you confirm whether or not this happened before EE 2.2.2 (assuming you had a version of the site in question before EE 2.2.2)?

  • #6 / Aug 18, 2011 1:00pm

    Kevin Smith

    4784 posts

    Just a quick update: I’ve been able to confirm this, and it’s definitely a bug. I’ve filed a bug report on it here. For now, does it work for everyone to use Ryan’s workaround of manually adding the same hidden field with the correct value later in the form?

  • #7 / Aug 18, 2011 4:04pm

    Andrea DeMers

    18 posts

    Hi Kevin,

    Thanks for the update.

    So far, the workaround described by Ryan is working fine for me.

    Edit: I can’t say for versions previous to 2.2.2

  • #8 / Aug 18, 2011 4:32pm

    Ryan M.

    1511 posts

    Your bug report looks accurate, Kevin, and the form does work when explicitly setting the comments to “y”. I can’t confirm this happened previous to 2.2.2 - we updated from 1.7 to 2.2.2.

  • #9 / Aug 19, 2011 6:17pm

    Kevin Smith

    4784 posts

    Ok, glad the bug report has all the right info. This looks like an easy one for the devs to reproduce, so that’s good news. I’d recommend just commenting on that bug report in order to be notified about updates.

    Anything else I can help with, or is it alright to mark this thread “Resolved”?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases