Jump to content

Block error when displaying the latest articles


donpetru

Recommended Posts

I don't know if there is a good section for this topic, but the IPS community does not have a dedicated forum for technical support or soft-forum reporting issues. I have not seen such a section that would treat such aspects clearly!

I have the latest IPS4 installed and I generated a block with the latest articles. This block has been integrated into the index page but the column that lists the latest comments added to the articles show my admin name to all articles, although I have not made the last comments !!!
For example, there are articles where I have not added any comments but the block displays the last comment made by me on all the articles listed. Be a template error !!! I don't think, because the default IPS4 template is the same thing!

So, the block code does not correctly identify the user who made the last comment on the last articles listed by the block !!! Is there any solution to this problem? Please.

This is the block code:

{{if !empty( $records ) }}
    <h3 class='ipsWidget_title ipsType_reset'>{$title}</h3>
    {{if $orientation == 'vertical'}}
        <div class='ipsPad_half ipsWidget_inner'>
            <ul class='ipsDataList ipsDataList_reducedSpacing ipsContained_container'>
                {{foreach $records as $record}}
                    <li class='ipsDataItem'>
                        <div class='ipsDataItem_icon ipsPos_top'>
                            {template="userPhoto" group="global" app="core" params="$record->author(), 'tiny'"}
                        </div>
                        <div class='ipsDataItem_main cWidgetComments'>
                            <div class="ipsCommentCount ipsPos_right {{if ( $record->record_comments ) === 0}}ipsFaded{{endif}}" data-ipsTooltip title='{lang="num_replies" pluralize="$record->record_comments"}'>{expression="$record->record_comments"}</div>
                            <div class='ipsType_break ipsContained'>
                                <a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" title='{lang="view_this_cmsrecord" sprintf="\IPS\Member::loggedIn()->language()->addToStack( 'content_db_lang_sl_' . $record::$customDatabaseId, FALSE ), $record->_title"}' class='ipsDataItem_title'>{$record->_title}</a>
                            </div>
                            <p class='ipsType_reset ipsType_medium ipsType_blendLinks'>
                                <span>PRINT {lang="byline_nodate" htmlsprintf="$record->author()->link()"}</span><br>
                                <span class="ipsType_light">{datetime="$record->mapped('date')"}</span>
                            </p>
                        </div>
                    </li>
                {{endforeach}}
            </ul>
        </div>
    {{else}}
        <div class='ipsWidget_inner'>
            <ul class='ipsDataList ipsContained_container'>
                {template="recordRow" group="listing" location="database" app="cms" themeClass="IPS\cms\Theme" params="null, null, $records"}
            </ul>
        </div>
    {{endif}}
{{endif}}

 

Link to comment
Share on other sites

The default IPS template here is not meant for comments, it's meant for records. Since you're using that same template, it's not presenting the information in the way that you think it is.

1. You are using the record author instead of the last commenter.

<span>PRINT {lang="byline_nodate" htmlsprintf="$record->author()->link()"}</span><br>

$record->author() refers to the member who wrote the RECORD, not the member who wrote the comment.

2. For horizontal orientation, you are straight-up calling the default IPS template, which will also use the record author.

{template="recordRow" group="listing" location="database" app="cms" themeClass="IPS\cms\Theme" params="null, null, $records"}

 

I think what you need is to set up a feed of comments, not a feed of articles. That should be closer to what you're looking for.

Link to comment
Share on other sites

Thanks for the answer but I attached an image to see the problem I wanted to highlight.

block.thumb.jpg.00ab8988226da0efefad3661ae2cb4f4.jpg

2 hours ago, HeadStand said:

You are using the record author instead of the last commenter.


<span>PRINT {lang="byline_nodate" htmlsprintf="$record->author()->link()"}</span><br>

$record->author() refers to the member who wrote the RECORD, not the member who wrote the comment.

The template default block is generated by the IPS platform. So, the code I posted above is not generated or created by me.

I also understand your point of view, but I do not have to create a comment feed, I would like to make this feed feasible with the latest articles.

Link to comment
Share on other sites

Does the last commenter show correctly when viewing the listing within the database?

On the surface my hunch is that you disabled "bumping" the record when a new comment is made (in the database settings), but I can't be certain without viewing the site and the configuration.

Link to comment
Share on other sites

Sorry for delay.

bfarber, thanks for the answer. The last commenter is show correctly when if I view the record. 

Now I found that the error only appears on the old registered items (articles) that are listed by the block. If I post a new article and I post a comment, then the block displays the correct who made the last comment.
The problem persists only with old articles written prior to updating from IPS from 4.3.X to 4.4.3. Although we've updated the article template, the block is failing to read who made the last comment on the old articles !!! Why ?

Regarding your next comment:

On 5/29/2019 at 4:58 PM, bfarber said:

On the surface my hunch is that you disabled "bumping" the record when a new comment is made (in the database settings), but I can't be certain without viewing the site and the configuration.

I've attached two images below:

2082267746_IPSdatabasearticlessetup.thumb.jpg.ffb127ae0e9800f70165c8e5af705e7e.jpg

1981711535_IPSblocksetup.thumb.jpg.4c20ac972150e1c3e4143228d7e83845.jpg


So the block displays the information, first depending on the last article added and then watches who made the last comment. So, from this point of view the settings I think are OK. It remains in question what we were saying above - see the red text.

Link to comment
Share on other sites

9 minutes ago, donpetru said:

Although we've updated the article template, the block is failing to read who made the last comment on the old articles !!! Why ?

This data isn’t “read” from the actual comment data. Last commenter actions are stored in the record database with each record. So if there is faulty data in there, changing the template won’t do anything. Only updating the record itself (e.g. through a new comment) would change something. 

As bfarber already said: If you want this investigated, have staff look at the site directly through a support ticket. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...