Establishing last post in template

Ingenious

Well-known member
Is there any way in a template (with a conditional) to establish whether the post being shown is the last one in a thread?

I'd like to remove the reply/quote option that appears under the last post, for a specific usergroup, in the last post only (it's for members who persistently quote all of the last post in a thread when replying and just adding one or two word replies!).

I can remove all the reply/quote options by wrapping it in a conditional based on usergroup, which encourages members to just use the reply box, click reply, or manually quote, but it can make life a bit difficult for quoting posts further up a thread. So would be great to only do this for the last post.

Hope that makes sense :)
 
Admin CP -> Appearance -> Templates -> post

Add the red code:

Rich (BB code):
			<div class="publicControls">
				<a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="item muted postNumber hashPermalink OverlayTrigger" data-href="{xen:link posts/permalink, $post}">#{xen:calc '{$post.position} + 1'}</a>
				<xen:hook name="post_public_controls" params="{xen:array 'post={$post}'}">
				<xen:if is="{$post.canLike}">
					<a href="{xen:link posts/like, $post}" class="LikeLink item control {xen:if $post.like_date, unlike, like}" data-container="#likes-post-{$post.post_id}"><span></span><span class="LikeLabel">{xen:if $post.like_date, {xen:phrase unlike}, {xen:phrase like}}</span></a>
				</xen:if>
				<xen:if is="{$canReply} AND (!{xen:helper ismemberof, $visitor, 2} OR {$post.position} != {$thread.reply_count})">
					<a href="{xen:link threads/reply, $thread, 'quote={$post.post_id}'}" data-postUrl="{xen:link posts/quote, $post}" class="ReplyQuote item control reply" title="{xen:phrase reply_quoting_this_message}"><span></span>{xen:phrase reply}</a>
				</xen:if>
				</xen:hook>
			</div>
		</div>
	</xen:set>

You need to specify the group id of the group that is not allowed to quote the last post.
 
Jake this is brilliant, it works perfectly, thanks again.

For those wondering WTF it does, have you banged your head against the wall with users who constantly quote the whole of the last post in a thread just to make a one or two word reply? Not only does this make a thread cluttered, it duplicates content, with potential issues for SEO and increases your database size. It's time to fight back - we all know that adding "Please do not quote the whole of the last post if you don't need to" to your forum rules does diddly squat because people don't read them.

This method is a very gentle way of just taking away the quote option on the last post in a thread only, for a selected usergroup only (without changing the options for anyone else).

1. Create a secondary usergroup called "No quote" or similar. Leave all permissions as not set, so it has no effect whatsoever on the user's other settings and permissions.
2. Add the code above to the post template, changing the number 2 to the number (ID) of the secondary usergroup.
3. When someone continually quotes the whole of the last post, add them to this usergroup. It will mean the quote option disappears from the last post only, so if they want to quote the last post, they have to do so manually. It also encourages them to get into the mindset that posting after the last message, without quoting it, is the "natural" way to add content to a thread.

I also recommend changing the default phrase "reply" from "Reply" to "Quote". This is because people intuitively click "Reply" and all this does is take them to the reply box (which they can scroll down to anyway) and quotes the whole of the post :) Changing it to Quote makes it clear, that option is a quote option.

So with all of the above, here is what the end of a thread's posts can look like:

Screen shot 2013-03-06 at 16.03.32.webp

Like and Quote options for all posts, with no quote option for the last post (only for members added to that no quote usergroup). Gently re-educate your worst last post "quote happy" offenders :)

Hope this is useful to other people.
 
Top Bottom