TSP Posted November 5, 2015 Posted November 5, 2015 In the blogs app you have numerous templates where the links simply goes to #comments. Which is no good in cases where there is numerous comments. You also have an unread marker, but the unread marker is absolutely no different from the regular link, even if you have read the blog post itself, which is not consistent with the forums app. My suggestions: 1. You should consider switching out all #comments-links with getNewComment for members. 2. If you haven't read the blog post itself you should be taken to the blog post. If you have read the blog post, you should be taken to the first unread comment. If this feels wrong for a method named "getNewComment" I would suggest to make something new like "getNewItemOrComment". But I don't see any issues with 'getNewComment' being used. We received very strong feedback on this from the people using the blog application when we upgraded a very active community from 3.4.8 to 4.0.13.1. As a result I decided to implement the following changes in my custom theme and do some custom changes to the code. This made the blog users we had more happy with the upgrade. There are smarter ways to do this probably, but just to share with you what I did: Changes to getNewComment-redirect: diff --git a/www/system/Content/Controller.php b/www/system/Content/Controller.php index 545233e..076f93f 100644 --- a/www/system/Content/Controller.php +++ b/www/system/Content/Controller.php @@ -850,6 +850,12 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller $timeLastRead = $item->timeLastRead(); if ( $timeLastRead instanceof \IPS\DateTime ) { + /* HW_CUSTOM redirect only to comments if item is already read */ + if ( $class == 'IPS\\blog\\Entry' and $timeLastRead < \IPS\DateTime::ts( $item->mapped('date') ) ) + { + \IPS\Output::i()->redirect( $item->url() ); + } + $comment = $item->comments( 1, NULL, 'date', 'asc', NULL, NULL, $timeLastRead ); \IPS\Output::i()->redirect( $comment ? $comment->url() : $item->url( 'getLastComment' ) ); } @@ -2001,4 +2007,4 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller return new \IPS\Helpers\CoverPhoto; } } -} \ No newline at end of file +} Theme changes: diff --git a/www/themes/2/html/blog/front/browse/rows.phtml b/www/themes/2/html/blog/front/browse/rows.phtml index cf1426e..3487475 100755 --- a/www/themes/2/html/blog/front/browse/rows.phtml +++ b/www/themes/2/html/blog/front/browse/rows.phtml @@ -87,8 +87,9 @@ {{endif}} {{if !$blog->latestEntry()->num_comments}} <li class='ipsType_light'>{lang="num_comments" pluralize="$blog->latestEntry()->num_comments"}</li> - {{else}} - <li><a href='{$blog->latestEntry()->url()}#comments' title='{lang="see_comments_on_entry"}'>{lang="num_comments" pluralize="$blog->latestEntry()->num_comments"}</a></li> + {{else}} + <!-- HW_CUSTOM get new comments url instead of just #comments --> + <li><a href='{{if \IPS\Member::loggedIn()->member_id}}{$blog->latestEntry()->url('getNewComment')}{{else}}{$blog->latestEntry()->url()}#comments{{endif}}' title='{lang="see_comments_on_entry"}'>{lang="num_comments" pluralize="$blog->latestEntry()->num_comments"}</a></li> {{endif}} </ul> {{else}} @@ -101,4 +102,4 @@ {{endforeach}} {{else}} <li><p class="ipsPad">{lang="no_results"}</p></li> -{{endif}} \ No newline at end of file +{{endif}} diff --git a/www/themes/2/html/blog/front/global/profileBlogRows.phtml b/www/themes/2/html/blog/front/global/profileBlogRows.phtml index 1bbd683..bc07b06 100755 --- a/www/themes/2/html/blog/front/global/profileBlogRows.phtml +++ b/www/themes/2/html/blog/front/global/profileBlogRows.phtml @@ -29,11 +29,12 @@ {{if !$blog->latestEntry()->num_comments}} <li class='ipsType_light'>{lang="num_comments" pluralize="$blog->latestEntry()->num_comments"}</li> {{else}} - <li><a href='{$blog->latestEntry()->url()}#comments' title='{lang="see_comments_on_entry"}'>{lang="num_comments" pluralize="$blog->latestEntry()->num_comments"}</a></li> + <!-- HW_CUSTOM add get new comments link for blog comments link --> + <li><a href='{{if \IPS\Member::loggedIn()->member_id}}{$blog->latestEntry()->url()}{{else}}{$blog->latestEntry()->url()}#comments{{endif}}' title='{lang="see_comments_on_entry"}'>{lang="num_comments" pluralize="$blog->latestEntry()->num_comments"}</a></li> {{endif}} </ul> {{endif}} </div> </div> </li> -{{endforeach}} \ No newline at end of file +{{endforeach}} diff --git a/www/themes/2/html/blog/front/view/blogViewLarge.phtml b/www/themes/2/html/blog/front/view/blogViewLarge.phtml index ab7e7ed..87559da 100755 --- a/www/themes/2/html/blog/front/view/blogViewLarge.phtml +++ b/www/themes/2/html/blog/front/view/blogViewLarge.phtml @@ -58,7 +58,8 @@ {{if \IPS\Settings::i()->blog_enable_rating}} <li>{template="rating" app="core" params="'small', $entry->averageRating()" group="global"}</li> {{endif}} - <li><a href='{$entry->url()}#comments' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$entry->num_comments"}</a></li> + <!-- HW_CUSTOM getnewcomment for comment url --> + <li><a href='{{if \IPS\Member::loggedIn()->member_id}}{$entry->url('getNewComment')}{{else}}{$entry->url()}#comments{{endif}}' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$entry->num_comments"}</a></li> <li class='ipsType_light'>{lang="num_views_with_number" pluralize="$entry->views"}</li> </ul> -</article> \ No newline at end of file +</article> diff --git a/www/themes/2/html/blog/front/view/blogViewMedium.phtml b/www/themes/2/html/blog/front/view/blogViewMedium.phtml index 31325c6..dfb7ace 100755 --- a/www/themes/2/html/blog/front/view/blogViewMedium.phtml +++ b/www/themes/2/html/blog/front/view/blogViewMedium.phtml @@ -49,7 +49,8 @@ </li> {{endif}} <li><strong><a href='{$entry->url()}' title="{lang="read_more_about" sprintf="$entry->name"}">{lang="read_more"}</a></strong></li> - <li><a href='{$entry->url()}#comments' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$entry->num_comments"}</a></li> + <!-- HW_CUSTOM getNewComment url for blog comment --> + <li><a href='{{if \IPS\Member::loggedIn()->member_id}}{$entry->url('getNewComment')}{{else}}{$entry->url()}#comments{{endif}}' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$entry->num_comments"}</a></li> <li class='ipsType_light'>{lang="num_views_with_number" pluralize="$entry->views"}</li> </ul> -</article> \ No newline at end of file +</article> diff --git a/www/themes/2/html/blog/front/view/blogViewSmall.phtml b/www/themes/2/html/blog/front/view/blogViewSmall.phtml index c1db8af..dcc5768 100755 --- a/www/themes/2/html/blog/front/view/blogViewSmall.phtml +++ b/www/themes/2/html/blog/front/view/blogViewSmall.phtml @@ -24,10 +24,11 @@ <input type='checkbox' data-role='moderation' name="moderate[{$entry->$idField}]" data-actions="{expression="implode( ' ', $table->multimodActions( $entry ) )"}" data-state='{{if $entry->tableStates()}}{$entry->tableStates()}{{endif}}'> </li> {{endif}} - <li> - <a href='{$entry->url()}#comments' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$entry->num_comments"}</a> + <li> + <!-- HW_CUSTOM add getNewComment for blog comments link --> + <a href='{{if \IPS\Member::loggedIn()->member_id}}{$entry->url('getNewComment')}{{else}}{$entry->url()}#comments{{endif}}' title='{lang="view_comments"}'><i class='fa fa-comment'></i> {lang="num_comments" pluralize="$entry->num_comments"}</a> </li> </ul> </div> </div> -</li> \ No newline at end of file +</li> diff --git a/www/themes/2/html/blog/front/browse/rows.phtml b/www/themes/2/html/blog/front/browse/rows.phtml index 3487475..f1a3dc1 100755 --- a/www/themes/2/html/blog/front/browse/rows.phtml +++ b/www/themes/2/html/blog/front/browse/rows.phtml @@ -18,7 +18,7 @@ <li class='ipsDataItem'> <div class='ipsDataItem_main'> {{if $entry->unread()}} - <a href='{$entry->url()}' title='{lang="view_this_entry" sprintf="$entry->name"}' class=''> + <a href='{$entry->url('getNewComment')}' title='{lang="view_this_entry" sprintf="$entry->name"}' class=''> <span class='ipsItemStatus ipsItemStatus_tiny'><i class='fa fa-circle'></i></span> </a> {{endif}} @@ -44,7 +44,8 @@ <div> <strong class='ipsType_minorHeading'>{lang="latest_entry"}</strong><br> <h3 class='ipsType_reset ipsType_sectionHead ipsType_blendLinks'> - <a href='{$blog->latestEntry()->url()}' title='{lang="view_this_entry" sprintf="$blog->latestEntry()->name"}'> + <!-- HW_CUSTOM fix blog url getNewComment url --> + <a href='{{if $blog->latestEntry()->unread()}}{$blog->latestEntry()->url('getNewComment')}{{else}}{$blog->latestEntry()->url()}{{endif}}' title='{lang="view_this_entry" sprintf="$blog->latestEntry()->name"}'> {{if $blog->latestEntry()->unread()}} <span class='ipsItemStatus' data-ipsTooltip title="{lang="unread_blog"}"><i class="fa fa-circle"></i></span> {{endif}}
Recommended Posts
Archived
This topic is now archived and is closed to further replies.