Customizing message_user_info and thread_view

intradox

Well-known member
Hi all,

I'm trying to pull out the username and usertitle which normally appear in message_user_info and place them in thread_view. The reason is that I'm reording some of the elements.

Here is what I'm trying to achieve:
UZovI.png


The problem at the moment is that the topbar appears blank and chrome tools show:
jsqLU.png


How do I get the username/title to appear?

Thanks!

Here is the code for thread_view:
Code:
<li id="{$messageId}" class="message {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'} {xen:if $message.isIgnored, ignored}" data-author="{$message.username}">
 
    <div class="messageTopBar">
        <div class="messageTopBar_userInfo"">
            <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>
    </xen:hook>
        </div>
    </div>
    <xen:include template="message_user_info">
        <xen:map from="$message" to="$user" />
    </xen:include>
...

Here is the code for message_info:
Code:
<xen:require css="message_user_info.css" />
 
<div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person"> 
<div class="messageUserBlock">
    <xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <div class="avatarHolder">
            <span class="helper"></span>
            <xen:avatar user="$user" size="m" />
            <!-- slot: message_user_info_avatar -->
        </div>
    </xen:hook>
 
<xen:if is="!{$isQuickReply}">
    <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>
    </xen:hook>
...
 
The thread_view template isn't post-specific. I assume you want to focus on the first post in the thread? In that case you can replace all instances of $user with $firstPost. But it's important to know that $firstPost is the first post on the current page within the thread. So when you move to page 2 it will be the first post on that page, not the first post in the thread.
 
The thread_view template isn't post-specific. I assume you want to focus on the first post in the thread? In that case you can replace all instances of $user with $firstPost. But it's important to know that $firstPost is the first post on the current page within the thread. So when you move to page 2 it will be the first post on that page, not the first post in the thread.
Actually I was hoping to somehow have the bar happen across all posts in the thread. I am trying to move the username and usertitle from under the avatar to it's own horizontal bar. The only way I could see doing this was editing thread_view but then it does not pull the username or title...?
 
In that case you would have to edit the message_user_info template, and possibly the message template as well which contains the entire post and not just the user block. I don't have instructions for the kind of layout change you are wanting.
 
I think a custom hook is needed as I read a user looking for something similar and they had to create some custom ones.

I opted for leaving the custom title in the description and simply posting at the top the default usergroup title with some custom styling:
8fkex.png
 
Not sure if this is what you wanted but it's super simple and pretty easy to customize. It obviously is made to be put with my topbar


Code:
/* BEGIN === CUSTOM GROUP TAGS */
.groupTag {
    float: left;
    padding: 2px 10px;
    margin: 0 2px 0 10px;
    background: rgb(139, 117, 48);
    line-height: 18px;
    border: 1px solid rgb(194, 194, 194);
    color: white;
}
.groupTag.admin {background:@primaryDark;color: rgb(0, 0, 0);border-color: rgb(58, 49, 49);}
.groupTag.admin:hover {background: rgb(236, 144, 6);}
.groupTag.mod {background: rgb(13, 173, 64);}
.groupTag.mod:hover {background: rgb(21, 155, 63);}
/* END === CUSTOM GROUP TAGS */

Code:
<div class="messageTopBar">
        <div class="messageTopBar_userInfo"">
            <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <h3 class="userText">
            <xen:username user="$post" />
            <xen:if is="{xen:helper ismemberof, $message, 3}">
                    <div class="groupTag admin">Admin</div>
                  </xen:if>
                  <xen:if is="{xen:helper ismemberof, $message, 4}">
                    <div class="groupTag mod">Mod</div>
                  </xen:if>
        </h3>
    </xen:hook>
        </div>
    </div>
 
Top Bottom