Bug #23603 Bug Fixed

comment_date format not rendering

Version: 4.2.1 Reporter: The Design Core

{comment_date format="%M %d, %Y @ %g:%i %a"} displays as code and does not render the date. Removing format=”%M %d, %Y @ %g:%i %a” will render, but adding the format breaks it.

Other comment fields such as {comment}, & {url_as_author} render correctly.

  • Can you share the full tag that you are using and confirm that you are running 4.2.1 as reported? It’s working fine for me.

    {exp:comment:entries}
        {comment_date format="%M %d, %Y @ %g:%i %a"}
    {/exp:comment:entries}

    renders:

    Apr 16, 2018 @ 12:57 pm
    Derek Jones
    11th May, 2018 at 12:59pm
  • {exp:comment:entries channel="blog" orderby="date" sort="desc"}
        {if no_results}There are no comments for this entry yet. Be the first!{/if}
           <div class="post-comment">
            <div class="avatar">
             /images/ui/avatar.png
            </div>
            <div class="post-body">
             <div class="post-message">
              {comment}
             </div>
             <div class="post-meta">
              Posted by {encode="{email}" title="{url_as_author}"} on {comment_date format="%M %d, %Y @ %g:%i %a"}
             </div>
            </div>
           </div>
       {/exp:comment:entries}

    I am running 4.2.1.

    The Design Core
    11th May, 2018 at 1:11pm
  • Actually just figured it out. The comment entry tag does not like it when you have next_entry/prev_entry tags in the same template.

    Is that to be expected or should the comment_date still work?

    The Design Core
    11th May, 2018 at 1:16pm
  • Can you post the full template? There’s nothing wrong with your sample code, and I don’t see next/prev entry tags there.

    Derek Jones
    11th May, 2018 at 1:31pm
  • I just have the following a little further up in the template:

    <div class="blog-nav">
        <div class="row full-width text-center">
         <div class="col-1-3">
          {exp:channel:next_entry channel="blog" status="open"}<a href="/blog/{url_title}">Next Post</a>{/exp:channel:next_entry}
         </div>
         <div class="col-1-3">
          <a href="http://{path=blog}"><i class="fas fa-th-large"></i></a>
         </div>
         <div class="col-1-3">
             {exp:channel:prev_entry channel="blog" status="open"}<a href="/blog/{url_title}">Prev Post</a>{/exp:channel:prev_entry}
         </div>
        </div>
    </div>
    The Design Core
    11th May, 2018 at 1:36pm
  • If I make that an embed, the date renders fine.

    The Design Core
    11th May, 2018 at 1:36pm
  • Perfect, thanks; looks like an accommodation we had to make to support a legacy comment entries extension hook was using cached data from other tags for its date variables. I’ve added a fix to the solution tab and this will be in the next patch release. Thanks for reporting!

    Derek Jones
    11th May, 2018 at 2:08pm
  • Thank you! The fix works.

    The Design Core
    11th May, 2018 at 4:43pm

You must be signed in to comment on a bug report.

  • On line 1700 of system/ee/legacy/libraries/Template.php, just after:

    $this->search_fields = $this->tag_data[$i]['search_fields'];

    add:

    $this->date_vars        = [];
    $this->modified_vars    = [];
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases