1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Styling and Customization Questions' started by Jesepi, Feb 27, 2011.

  1. Jesepi

    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?

    Attached Files:

  2. Brogan

    Brogan XenForo Moderator Staff Member

    There is no specific forum for requests such as this so I have moved it to general support.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Edit this template:

    Admin CP -> Appearance -> Templates -> message

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

    <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" />
    	<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: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>
    		<div class="messageContent">
    			<article><blockquote class="messageText ugc baseHtml">{xen:raw $message.messageHtml}</blockquote></article>
    			{xen:raw $messageContentAfterTemplate}
    		<xen:if is="{$visitor.content_show_signature} && {$message.signature}">
    			<div class="baseHtml signature ugc"><aside>{xen:raw $message.signatureHtml}</aside></div>
    		{xen:raw $messageAfterTemplate}
    		<div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>
    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):

    <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 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 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 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: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>
    			<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>
    This is the result:

    Screen shot 2011-02-27 at 9.57.59 PM.png
    THLove, PASS and TsinJu like this.
  4. Jesepi

    Jesepi Well-Known Member

    much appreciated, thank you
  5. tonnyz

    tonnyz Member

    @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 :)
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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
    tonnyz likes this.
  7. tonnyz

    tonnyz Member

    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:
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
  9. PASS

    PASS Active Member

    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.

    <xen:if is="{$canReply}">
                    <xen:if is="{$xenOptions.multiQuote}"><a href="{xen:link threads/reply, $thread, 'quote={$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>
    Last edited: Mar 28, 2015
  10. Sunka

    Sunka Well-Known Member

    I solved this way...

    Add this in Extra.css

    .messageUserInfo abbr,
    .messageUserInfo span.DateTime {
        position: relative;
        padding: 5px 10px 5px 10px;
        line-height: 16px;
        font-size: 10.5px;
    .messageUserBlock .arrow span {
        border-left-color:#d7edfc !important;
    And in template mesage_user_info
    Find this:
    <xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    After that insert:
    <xen:datetime time="$post.post_date" />
    NUT65, Buffaloed and PASS like this.
  11. PASS

    PASS Active Member

    @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?

Share This Page