Skip to content

Instantly share code, notes, and snippets.

@ilyahoilik
Last active February 7, 2022 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyahoilik/2528d3c6716bfa6f3fe510a25738426a to your computer and use it in GitHub Desktop.
Save ilyahoilik/2528d3c6716bfa6f3fe510a25738426a to your computer and use it in GitHub Desktop.

This is how to integrate Click to Mention into Pages application.

Go to ACP > Pages > Page Management > Templates. Select comment template from the Display templates group.

Find:

<h3 class='ipsComment_author ipsType_blendLinks'>
	<strong class='ipsType_normal'>{template="userLink" app="core" group="global" params="$comment->author(), $comment->warningRef()"}</strong>
	{template="reputationBadge" group="global" app="core" params="$comment->author()"}
</h3>

Modify:

<h3 class='ipsComment_author ipsType_blendLinks'>
	<strong class='ipsType_normal'>
		{{if settings.ctm_position == 'before_member_name'}}
			{template="userLinkMention" group="plugins" location="global" app="core" params="$comment->author(), $comment->warningRef(), FALSE, $comment->isAnonymous(), 'before_member_name'"}
			{template="userLink" app="core" group="global" params="$comment->author(), $comment->warningRef(), NULL, $comment->isAnonymous()"}
		{{elseif settings.ctm_position == 'after_member_name'}}
			{template="userLink" app="core" group="global" params="$comment->author(), $comment->warningRef(), NULL, $comment->isAnonymous()"}
			{template="userLinkMention" group="plugins" location="global" app="core" params="$comment->author(), $comment->warningRef(), FALSE, $comment->isAnonymous(), 'after_member_name'"}
		{{elseif settings.ctm_position == 'instead_of_member_name'}}
			{template="userLinkMention" group="plugins" location="global" app="core" params="$comment->author(), $comment->warningRef(), FALSE, $comment->isAnonymous(), 'instead_of_member_name'"}
		{{else}}
			{template="userLink" app="core" group="global" params="$comment->author(), $comment->warningRef(), NULL, $comment->isAnonymous()"}
		{{endif}}
	</strong>
	{{if $comment instanceof \IPS\Content\Anonymous and $comment->isAnonymous() and \IPS\Member::loggedIn()->modPermission('can_view_anonymous_posters')}}
		<a data-ipsHover data-ipsHover-width="370" data-ipsHover-onClick href="{$comment->url( 'reveal' )->csrf()}"><span class="cAuthorPane_badge cAuthorPane_badge_small cAuthorPane_badge--anon" data-ipsTooltip title="{lang="post_anonymously_reveal"}"></span></a>
	{{endif}}
	{template="reputationBadge" group="global" app="core" params="$comment->author()"}
</h3>

Find:

<ul class='ipsComment_controls ipsClearfix ipsItemControls_left' data-role="commentControls">
	{{if $comment->hidden() === 1 && ( $comment->canUnhide() || $comment->canDelete() )}}

Modify:

<ul class='ipsComment_controls ipsClearfix ipsItemControls_left' data-role="commentControls">
	{template="userLinkMention" group="plugins" location="global" app="core" params="$comment->author(), $comment->warningRef(), FALSE, $comment->isAnonymous(), 'button_before_controls'"}
	{{if $comment->hidden() === 1 && ( $comment->canUnhide() || $comment->canDelete() )}}

Find:

<li data-ipsQuote-editor='{$editorName}' data-ipsQuote-target='#comment-{$comment->$idField}' class='ipsJS_show'>
	<button class='ipsButton ipsButton_light ipsButton_verySmall ipsButton_narrow cMultiQuote ipsHide' data-action='multiQuoteComment' data-ipsTooltip data-ipsQuote-multiQuote data-mqId='mq{$comment->$idField}' title='{lang="multiquote"}'><i class='fa fa-plus'></i></button>
</li>
<li data-ipsQuote-editor='{$editorName}' data-ipsQuote-target='#comment-{$comment->$idField}' class='ipsJS_show'>
	<a href='#' data-action="quoteComment" data-ipsQuote-singleQuote>{lang="quote"}</a>
</li>

Modify:

<li data-ipsQuote-editor='{$editorName}' data-ipsQuote-target='#comment-{$comment->$idField}' class='ipsJS_show'>
	<button class='ipsButton ipsButton_light ipsButton_verySmall ipsButton_narrow cMultiQuote ipsHide' data-action='multiQuoteComment' data-ipsTooltip data-ipsQuote-multiQuote data-mqId='mq{$comment->$idField}' title='{lang="multiquote"}'><i class='fa fa-plus'></i></button>
</li>
{template="userLinkMention" group="plugins" location="global" app="core" params="$comment->author(), $comment->warningRef(), FALSE, $comment->isAnonymous(), 'before_controls'"}
<li data-ipsQuote-editor='{$editorName}' data-ipsQuote-target='#comment-{$comment->$idField}' class='ipsJS_show'>
	<a href='#' data-action="quoteComment" data-ipsQuote-singleQuote>{lang="quote"}</a>
</li>
{template="userLinkMention" group="plugins" location="global" app="core" params="$comment->author(), $comment->warningRef(), FALSE, $comment->isAnonymous(), 'after_controls'"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment