[request] Move post date and post number to top of thread

Jesepi

Well-known member
I'm looking for the best way to format the post's date/time and post number to be at the top of each post. Something like the attached example.

Is anyone able to assist?

Also... is this the proper form for requests instead of contributions? If not.. where? If there isn't an official place could we get a template request subform?
 

Attachments

  • message-header.webp
    message-header.webp
    4.5 KB · Views: 138
Edit this template:

Admin CP -> Appearance -> Templates -> message

Use this code for this template (added {xen:raw $messageBeforeTemplate}):

Code:
<xen:require css="message.css" />
<xen:require css="bb_code.css" />

<li id="{$messageId}" class="message {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'}" data-author="{$message.username}">

	{xen:raw $messageBeforeTemplate}

	<xen:include template="message_user_info">
		<xen:map from="$message" to="$user" />
	</xen:include>

	<div class="messageInfo primaryContent">
		<xen:if is="{$message.isNew}"><strong class="newIndicator"><span></span>{xen:phrase new}</strong></xen:if>

		<xen:if hascontent="true">
			<ul class="messageNotices">
				<xen:contentcheck>
					<xen:if is="{$message.isDeleted}">
						<li class="deletedNotice">{xen:phrase this_message_has_been_removed_from_public_view}</li>
					<xen:elseif is="{$message.isModerated}" />
						<li class="moderatedNotice">{xen:phrase this_message_is_awaiting_moderator_approval_and_is_invisible_to_normal}</li>
					</xen:if>
				</xen:contentcheck>
			</ul>
		</xen:if>

		<div class="messageContent">
			<article><blockquote class="messageText ugc baseHtml">{xen:raw $message.messageHtml}</blockquote></article>

			{xen:raw $messageContentAfterTemplate}
		</div>

		<xen:if is="{$visitor.content_show_signature} && {$message.signature}">
			<div class="baseHtml signature ugc"><aside>{xen:raw $message.signatureHtml}</aside></div>
		</xen:if>

		{xen:raw $messageAfterTemplate}

		<div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>
	</div>

</li>

Then edit this template:

Admin CP -> Appearance -> Templates -> post

Use this code for this template (added <xen:set var="$messageBeforeTemplate">...</xen:set> and removed the date/time post number code from the original location):

Code:
<xen:include template="message">

	<xen:map from="$post" to="$message" />

	<xen:set var="$messageId">post-{$post.post_id}</xen:set>

	<xen:set var="$likesUrl">{xen:link posts/likes, $post}</xen:set>

	<xen:set var="$messageContentAfterTemplate"><xen:if is="{$post.attachments}"><xen:include template="attached_files" /></xen:if></xen:set>

	<xen:set var="$messageAfterTemplate">

		<div class="messageMeta">

			<div class="privateControls">
				<xen:if is="{$post.canInlineMod}"><input type="checkbox" name="posts[]" value="{$post.post_id}" class="InlineModCheck item" data-target="#post-{$post.post_id}" title="{xen:phrase select_this_post_by_x, 'name={$post.username}'}" /></xen:if>
				<xen:if is="{$post.canEdit}">
					<a href="{xen:link posts/edit, $post}" class="item control edit OverlayTrigger"
						data-href="{xen:link posts/edit-inline, $post}" data-overlayOptions="{&quot;fixed&quot;:false}"
						data-messageSelector="#post-{$post.post_id}"><span></span>{xen:phrase edit}</a>
					<xen:require js="js/xenforo/discussion.js" />
				</xen:if>
				<xen:if is="{$post.canDelete}"><a href="{xen:link posts/delete, $post}" class="item control delete OverlayTrigger"><span></span>{xen:phrase delete}</a></xen:if>
				<xen:if is="{$post.canCleanSpam}"><a href="{xen:link spam-cleaner, $post}" class="item control deleteSpam OverlayTrigger"><span></span>{xen:phrase spam}</a></xen:if>
				<xen:if is="{$canViewIps} AND {$post.ip_id}"><a href="{xen:link posts/ip, $post}" class="item control ip OverlayTrigger"><span></span>{xen:phrase ip}</a></xen:if>
				<xen:if is="{$visitor.user_id}"><a href="{xen:link posts/report, $post}" class="OverlayTrigger item control report" data-cacheOverlay="false"><span></span>{xen:phrase report}</a></xen:if>
			</div>

			<div class="publicControls">
				<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}">
					<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>
			</div>
		</div>
	</xen:set>

	<xen:set var="$messageBeforeTemplate">
		<div class="messageMeta" style="padding: 0px 5px 10px;">
			<div class="privateControls">
				<span class="item muted">
					<xen:username user="$post" class="author" />,
					<a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="datePermalink"><xen:datetime time="$post.post_date" /></a>
				</span>
			</div>

			<div class="publicControls">
				<a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" class="item muted postNumber hashPermalink" title="{xen:phrase permalink}">#{xen:calc '{$post.position} + 1'}</a>
			</div>
		</div>
	</xen:set>

</xen:include>

This is the result:

Screen shot 2011-02-27 at 9.57.59 PM.webp
 
@Jake Bunce
It works perfectly for thread post, but does not work for the conversation post & profile post.

Any help for those two please ?

thx :)

Make a similar edit to this template as in the post template above:

Admin CP -> Appearance -> Templates -> conversation_message

Profile posts use a different system (they don't include the message template), so the code will be different, but this is the template:

Admin CP -> Appearance -> Templates -> profile_post_comment
 
Make a similar edit to this template as in the post template above:

Admin CP -> Appearance -> Templates -> conversation_message

Profile posts use a different system (they don't include the message template), so the code will be different, but this is the template:

Admin CP -> Appearance -> Templates -> profile_post_comment

Thanks, it works @Jake Bunce ! :)

Another question, I find out that after some times of editing in 'post' template, {xen:raw $messageBeforeTemplate} inserted in the 'message' template will always disappear.

Any idea why ? :confused:
 
Thanks, it works @Jake Bunce ! :)

Another question, I find out that after some times of editing in 'post' template, {xen:raw $messageBeforeTemplate} inserted in the 'message' template will always disappear.

Any idea why ? :confused:

post includes message in the editor as its own tab, so when editing both templates in separate windows it is possible to overwrite one by saving the other.
 
After doing this, I enabled multi-quote in Options and the button is not showing. Multi-Quote code is missing from the post template. I added it back and the button is now showing.

Code:
<xen:if is="{$canReply}">
                <xen:if is="{$xenOptions.multiQuote}"><a href="{xen:link threads/reply, $thread, 'quote={$post.post_id}'}"
                        data-messageid="{$post.post_id}"
                        class="MultiQuoteControl JsOnly item control"
                        title="{xen:phrase toggle_multi_quote_tooltip}"><span></span><span class="symbol">{xen:phrase multiquote_add}</span></a></xen:if>
                    <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>
 
Last edited:
I solved this way...

Add this in Extra.css

Code:
.messageUserInfo abbr,
.messageUserInfo span.DateTime {
    position: relative;
    padding: 5px 10px 5px 10px;
    line-height: 16px;
    display:block;
    font-size: 10.5px;
}

.messageUserBlock .arrow span {
    border-left-color:#d7edfc !important;
}

And in template mesage_user_info
Find this:
Code:
<xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
After that insert:
Code:
<xen:datetime time="$post.post_date" />
 
@Jake B. I been using this edit for a while now. Just noticed the other day that the permalink popup with the links no longer shows when you click on the post number. Is there an update for this?
 
Edit this template:

Admin CP -> Appearance -> Templates -> message

Use this code for this template (added {xen:raw $messageBeforeTemplate}):

Code:
<xen:require css="message.css" />
<xen:require css="bb_code.css" />

<li id="{$messageId}" class="message {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'}" data-author="{$message.username}">

    {xen:raw $messageBeforeTemplate}

    <xen:include template="message_user_info">
        <xen:map from="$message" to="$user" />
    </xen:include>

    <div class="messageInfo primaryContent">
        <xen:if is="{$message.isNew}"><strong class="newIndicator"><span></span>{xen:phrase new}</strong></xen:if>

        <xen:if hascontent="true">
            <ul class="messageNotices">
                <xen:contentcheck>
                    <xen:if is="{$message.isDeleted}">
                        <li class="deletedNotice">{xen:phrase this_message_has_been_removed_from_public_view}</li>
                    <xen:elseif is="{$message.isModerated}" />
                        <li class="moderatedNotice">{xen:phrase this_message_is_awaiting_moderator_approval_and_is_invisible_to_normal}</li>
                    </xen:if>
                </xen:contentcheck>
            </ul>
        </xen:if>

        <div class="messageContent">
            <article><blockquote class="messageText ugc baseHtml">{xen:raw $message.messageHtml}</blockquote></article>

            {xen:raw $messageContentAfterTemplate}
        </div>

        <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
            <div class="baseHtml signature ugc"><aside>{xen:raw $message.signatureHtml}</aside></div>
        </xen:if>

        {xen:raw $messageAfterTemplate}

        <div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>
    </div>

</li>

Then edit this template:

Admin CP -> Appearance -> Templates -> post

Use this code for this template (added <xen:set var="$messageBeforeTemplate">...</xen:set> and removed the date/time post number code from the original location):

Code:
<xen:include template="message">

    <xen:map from="$post" to="$message" />

    <xen:set var="$messageId">post-{$post.post_id}</xen:set>

    <xen:set var="$likesUrl">{xen:link posts/likes, $post}</xen:set>

    <xen:set var="$messageContentAfterTemplate"><xen:if is="{$post.attachments}"><xen:include template="attached_files" /></xen:if></xen:set>

    <xen:set var="$messageAfterTemplate">

        <div class="messageMeta">

            <div class="privateControls">
                <xen:if is="{$post.canInlineMod}"><input type="checkbox" name="posts[]" value="{$post.post_id}" class="InlineModCheck item" data-target="#post-{$post.post_id}" title="{xen:phrase select_this_post_by_x, 'name={$post.username}'}" /></xen:if>
                <xen:if is="{$post.canEdit}">
                    <a href="{xen:link posts/edit, $post}" class="item control edit OverlayTrigger"
                        data-href="{xen:link posts/edit-inline, $post}" data-overlayOptions="{&quot;fixed&quot;:false}"
                        data-messageSelector="#post-{$post.post_id}"><span></span>{xen:phrase edit}</a>
                    <xen:require js="js/xenforo/discussion.js" />
                </xen:if>
                <xen:if is="{$post.canDelete}"><a href="{xen:link posts/delete, $post}" class="item control delete OverlayTrigger"><span></span>{xen:phrase delete}</a></xen:if>
                <xen:if is="{$post.canCleanSpam}"><a href="{xen:link spam-cleaner, $post}" class="item control deleteSpam OverlayTrigger"><span></span>{xen:phrase spam}</a></xen:if>
                <xen:if is="{$canViewIps} AND {$post.ip_id}"><a href="{xen:link posts/ip, $post}" class="item control ip OverlayTrigger"><span></span>{xen:phrase ip}</a></xen:if>
                <xen:if is="{$visitor.user_id}"><a href="{xen:link posts/report, $post}" class="OverlayTrigger item control report" data-cacheOverlay="false"><span></span>{xen:phrase report}</a></xen:if>
            </div>

            <div class="publicControls">
                <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}">
                    <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>
            </div>
        </div>
    </xen:set>

    <xen:set var="$messageBeforeTemplate">
        <div class="messageMeta" style="padding: 0px 5px 10px;">
            <div class="privateControls">
                <span class="item muted">
                    <xen:username user="$post" class="author" />,
                    <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="datePermalink"><xen:datetime time="$post.post_date" /></a>
                </span>
            </div>

            <div class="publicControls">
                <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" class="item muted postNumber hashPermalink" title="{xen:phrase permalink}">#{xen:calc '{$post.position} + 1'}</a>
            </div>
        </div>
    </xen:set>

</xen:include>

This is the result:

View attachment 11719
AD CODE HERE
Thanks
 
Top Bottom