XF 1.5 adding to individual message footer area

TomCann

Member
My community is obsessed with the amount of vertical space being taken up by the avatar and user info that appears below on individual messages within a thread.

Is it possible to replicate some of the information that appears below avatars in the footer line of the message? I am referring to the line that gives poster id and timestamp? So for example:

John Smith, Today at 1:16 PM

would become:
John Smith, UK, Today at 1:16 PM

...so the location field has been added to this line, and subsequently can be hidden from below the avatar to save vertical space?

Information on how and what to edit would be gratefully received. Have searched the forums to no avail.
 
Just wondering if there's anything I can clarify or add to this question to see if it prompts any answers? I asked the question of Xenforo support and they said what I want to do is certainly possible, but not a support issue, so I should ask the forum.
 
Thanks Wang, I hope this illustrates it: trying to add the message poster's location before the timestamp: in this example adding 'UK' as the poster's location:

View attachment 125195

Go to the post template and find this code.

Code:
<span class="item muted">
                    <span class="authorEnd"><xen:username user="$post" class="author" />,</span>
                    <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="datePermalink"><xen:datetime time="$post.post_date" /></a>
                </span>

And replace it with this.

Code:
<span class="item muted">
                    <span class="authorEnd"><xen:username user="$post" class="author" />,</span>
                   
                    <xen:if is="{$visitor.location}">
                   
                        Location: <a href="{xen:link 'misc/location-info', '', 'location={xen:string censor, $visitor.location, '-'}'}" target="_blank" rel="nofollow" itemprop="address" class="concealed">{xen:string censor, $visitor.location}</a>,
                         </xen:if>
                   
                    <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="datePermalink"><xen:datetime time="$post.post_date" /></a>
                </span>

This will be the result. Note that I have hardcoded the word location. You can also create a proper phrase for it.

screenshot.webp
 
Wang,

Many thanks for that. Inserting the code didn't work for me, but I am wondering if it is because I had already removed the label 'Location' from the location element in the message_user_info template? I currently show the location in the user panel below the avatar (that's the point of this, to 'move' it out of the avatar block). Could that be stopping your code from working?

Many thanks for your help once again.
 
Wang,

Many thanks for that. Inserting the code didn't work for me, but I am wondering if it is because I had already removed the label 'Location' from the location element in the message_user_info template? I currently show the location in the user panel below the avatar (that's the point of this, to 'move' it out of the avatar block). Could that be stopping your code from working?

Many thanks for your help once again.

You are welcome sir.

The only thing that I can think of that will make the location not appear at the code I posted above, is if the members have not filled in the location field. If that is left empty then the location will not be displayed.
 
Thanks Wang. That's not it, as their location is appearing OK in the avatar block. But having inserted your code nothing changes in the footer line of the post. I removed your 'xen:if' statement around the location line of your code, and the word "Location:" showed up, but with nothing in the actual location field itself.

Thanks again for taking the time to reply.
 
Thanks Wang. That's not it, as their location is appearing OK in the avatar block. But having inserted your code nothing changes in the footer line of the post. I removed your 'xen:if' statement around the location line of your code, and the word "Location:" showed up, but with nothing in the actual location field itself.

Thanks again for taking the time to reply.

No problem sir :)

That is strange. It appears fine for my in my developing forum. Can you use $user instead of $visitor? But $visitor is a global variable and should have displayed the info.
 
Back
Top Bottom