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

Customizing message_user_info and thread_view

Discussion in 'Styling and Customization Questions' started by intradox, Aug 21, 2012.

  1. intradox

    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:
    [​IMG]

    The problem at the moment is that the topbar appears blank and chrome tools show:
    [​IMG]

    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>
    ...
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
    intradox and Shelley like this.
  3. intradox

    intradox Well-Known Member

    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...?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  5. StRonK

    StRonK Active Member

    hi Jake I have solved this issue with <xen:username rich="true" user="$post" /> codes but I could not place usertitle to there :cry: .
     
  6. intradox

    intradox Well-Known Member

    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:
    [​IMG]
     
  7. arcaneex

    arcaneex Active Member

    Could you possibly share the custom name and tags ( admin , mod etc ) things? looks epic!
     
  8. intradox

    intradox Well-Known Member

    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>
     
    Jake Bunce likes this.
  9. arcaneex

    arcaneex Active Member

    where do I put the css? extra.css?
     
  10. intradox

    intradox Well-Known Member

    Pasting it directly into extra.css would make it work.
     
  11. arcaneex

    arcaneex Active Member

    Meh didn't work. Oh well.
     
  12. intradox

    intradox Well-Known Member

    It's a custom span tag. So you would have to implement the span tag or modify the css class to match the usertitle.
     

Share This Page