Jump to content


Developer Documentation

Recommended Replies

Invision Community 4.2 introduces the new Recommended Replies feature, which allows moderators to recommend comment on content items, that will then appear above all comments, on all pages.

To add this feature to your content item, you must first implement the \IPS\Content\MetaData interface to add support for storing Meta Data on your content item.

Once Meta Data has implemented, you need to add core_FeaturedComments to your supportedMetaDataTypes() method.

public static function supportedMetaDataTypes()
	return array( 'core_FeaturedComments' );

Once Recommend Replies has been added as a supported data type, then you must add the following line to your comments template, where you want Recommend Replies to show.

{template="featuredComments" group="global" app="core" params="$item->featuredComments(), $item->url()->setQueryString( 'recommended', 'comments' )"}


Or, if you application supports both Comments and Reviews:

{template="featuredComments" group="global" app="core" params="$item->featuredComments(), $item->url()->setQueryString('tab', 'comments')->setQueryString('recommended', 'comments')"}


Additionally, the featuredComments template supports two additional parameters:

  • $titleLang - This is the title of the recommend replies area (default: recommended_replies).
  • $commentLang - This is the title of each individual comment (default: __defart_comment).


Applications that use the comment and commentContainer templates from the System application will not need to do anything further. Applications that use custom templates, however, need to add the following to their comment template, where their moderation menu is:

									{{if $comment->isFeatured() AND $item->canUnfeatureComment()}}
										<li class='ipsMenu_item'><a href='{$comment->url('unfeature')->csrf()->setQueryString('page',\IPS\Request::i()->page)}' data-action="unrecommendComment">{lang="unrecommend_content"}</a></li>
									{{if !$comment->isFeatured() AND $item->canFeatureComment()}}
										<li class='ipsMenu_item'><a href='{$comment->url('feature')->csrf()->setQueryString('page', \IPS\Request::i()->page)}' data-ipsDialog data-ipsDialog-title='{lang="recommend_comment"}' data-ipsDialog-remoteSubmit data-ipsDialog-size='narrow' data-action="recommendComment">{lang="recommend_content"}</a></li>


And then, if you want to highlight recommend content, the following changes need to be made.

For commentContainer you need to add the following to your <article> tags class attribute:

{{if $comment->isFeatured()}}ipsComment_popular{{endif}}

And then in your comment template, add the following immediately inside your opening <div> tag:

	{{if $comment->isFeatured()}}
		<strong class='ipsComment_popularFlag' data-ipsTooltip title='{lang="this_is_a_featured_post"}'><i class='fa fa-star'></i></strong>


Edited by Ryan Ashbrook

  Report Document

  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy