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.

Comment Form

October 23, 2010 3:34pm

Subscribe [5]
  • #1 / Oct 23, 2010 3:34pm

    code72

    104 posts

    Hi there,

    Just want to make sure I’m not missing something new in EE 2.1.1, but I’m just building a blog and the comment feature is not working. Upon clicking submit, nothing is submitted and I am just taken back to the homepage.  Here is my template code:

    {embed=embeds/header}
    
    <div class="main">
        {exp:channel:entries channel="blog" limit="1" disable="member_data"}
            <h1>{title}</h1>
            {entry_date format="%F %j, %Y"}
            {intro}
            {content}
        {/exp:channel:entries}
        
        <div class="comment_area">
            {exp:comment:entries channel="blog"}
                {if {count} == '1'}
                    <h2>Commments</h2>
    <p>            {/if}<br />
                <br />
                <div class="comment{if {author_id} == '3'} author_comment{/if}"><br />
                    {comment}<br />
                    {url_as_author} | {comment_date format="%F %j, %Y <span>at</span> %h:%i %A"}<br />
                </div><br />
            {/exp:comment:entries}<br />
            <br />
            {exp:comment:form channel="blog"}<br />
                </p><h2>Post a Comment</h2>
    <p>            <br />
                {if logged_out}<br />
                    <br />
                        Please enter your information below to share your thoughts. Please be nice.<br />
                    <br />
                    <br />
                        <label for="name">Name</label> <span class="alert">(Required)</span></p>
    
    <p>                    <input type="text" name="name" id="name" value="{name}" /><br />
                    <br />
                    <br />
                    <br />
                        <label for="email">Email Address</label> <span class="alert">(Required, will not be published)</span></p>
    
    <p>                    <input type="text" name="email" id="email" value="{email}" /><br />
                    <br />
                    <br />
                    <br />
                        <label for="url">Website URL</label> (Optional)</p>
    
    <p>                    <input type="text" name="url" id="url" value="{url}" /><br />
                    <br />
                {/if}<br />
                <br />
                <br />
                    <label for="comment">Your Comment</label></p>
    
    <p>                <textarea name="comment" id="comment" cols="50" rows="10">{comment}</textarea><br />
                <br />
                <br />
                <br />
                    <input class="checkbox" type="checkbox" name="save_info" value="yes" {save_info} /> Remember me?</p>
    
    <p>                <input class="checkbox" type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?<br />
                <br />
                <br />
                {if captcha}<br />
                    <div class="captcha"><br />
                        Please enter the word you see in the image below:</p>
    
    <p>                    {captcha} <input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p><br />
                    </div><br />
                {/if}<br />
                <br />
                <input type="submit" name="submit" value="Submit" class="button" /></p><br />
            {/exp:comment:form}<br />
        </div><br />
    </div></p>
    
    <p>{embed=embeds/sidebar}</p>
    
    <p>{embed=embeds/footer}

    And here is the live page: http://www.weclimbforkids.com/blog/article/sample_blog_post_2

    Am I just missing something stupid?

  • #2 / Oct 24, 2010 3:23pm

    Greg Salt

    3988 posts

    Hi code72,

    If you are using an .htaccess file can you please temporarily disable it and then replace index.php as the site index file in your Admin > General Configuration and then test this again. Also, the preview parameter is required.

    Cheers

    Greg

  • #3 / Nov 02, 2010 12:00am

    code72

    104 posts

    OK, that did the trick.  Below is the .htaccess file I was using.  Is there something wrong with it?

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^weclimbforkids.com$
    RewriteRule (.*) <a href="http://www.weclimbforkids.com/$1">http://www.weclimbforkids.com/$1</a> [R=301]
    
    RewriteCond $1 ^(blog|climbers|embeds|events|help|partners|site|why|P[0-9]{2,8}) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L] 
    
    ErrorDocument 404 /site/404
  • #4 / Nov 02, 2010 5:18pm

    Ingmar

    29245 posts

    Unfortunately we cannot officially support server side rewriting issues. Let me move this thread to the CodeShare Corner for you. Thanks.

  • #5 / Nov 02, 2010 5:48pm

    sdireland

    4 posts

    Has anyone else had any problem with comments not working since upgrading a site from EE1 to EE2?

  • #6 / Nov 02, 2010 5:52pm

    Lisa Wess

    20502 posts

    The normal culprit in any forms not sending data - just redirecting - is forcibly adding or removing www, as per:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^weclimbforkids.com$
    RewriteRule (.*) <a href="http://www.weclimbforkids.com/$1">http://www.weclimbforkids.com/$1</a> [R=301]

    I’m not sure what the solution is, but someone good with these files may have some ideas.  Just wanted to help you get on the right track.

    sdireland - if you’re having a problem with comments, please post a nice, detailed thread in the tech support forums so we can help you out.

    Thanks!

  • #7 / Nov 02, 2010 7:35pm

    code72

    104 posts

    Thanks Lisa.  I understand you guys can’t always support everything.  However it should be noted that the same .htaccess file works fine in previous versions of EE.  It’s only the latest version that has issues with this .htaccess file and commenting.

  • #8 / Nov 02, 2010 9:22pm

    Greg Aker

    6022 posts

    hey code72, I just tried a test comment, and it seemed to work out nicely.  have you figured it out?

  • #9 / Nov 02, 2010 10:16pm

    code72

    104 posts

    No, my .htaccess file is still disabled.

  • #10 / Nov 06, 2010 1:38pm

    sdireland

    4 posts

    Thanks Lisa for the advice. I had some time earlier in the week and managed to fix the comments issue.

    Lisa, you were right about the forcible removal of www. I commented this out - but this still didn’t fix. I then compared the .htaccess from another EE2 website I was running and tested commenting there. I found the other site using a different rewrite rule for the ‘removal of the trailing slash from paths without an extension’. This seemed to fix comments - code72, you might want to check and compare. I’ve copied old and new htaccess parts below

    OLD

    # remove the www
    RewriteCond %{HTTP_HOST} ^(www\.$) [NC]
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # Add a trailing slash to paths without an extension
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule ^(.*)$ $1/ [L,R=301]

    NEW

    # remove the www
    # RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
    # RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
    
    # Remove the trailing slash to paths without an extension
    RewriteCond %{REQUEST_URI} /$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ $1 [L,R=301]

    Good luck!

    And can someone explain the differences?

  • #11 / Nov 18, 2010 10:05am

    code72

    104 posts

    OK, I’ve confirmed that forcing the ‘www’ is causing the problem. Removing ‘index.php’ works fine. Sadly my .htaccess skills are rather limited, so i’m not exactly sure what to do next. It does look like there is some sort of redirect happening when comments are submitted.  I’m guessing whatever is going on there is not compatible with the ‘www’ thing. Something in the new comment module perhaps?

    sdireland, I’m doing nothing with the trailing slash.

  • #12 / Dec 02, 2010 11:41pm

    code72

    104 posts

    Has no one else complained about this?  I’m not an .htaccess expert, but I’m a bit surprised this hasn’t been more of an issue.  Doesn’t everyone do the ‘www’ redirect for SEO?  Does nobody care that doing so means comments don’t work?  Am I just missing an active thread on the subject?

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

ExpressionEngine News!

#eecms, #events, #releases