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

XF 1.4 Last activity and warnings in message user info (post)

Discussion in 'Styling and Customization Questions' started by Sunka, Jan 25, 2015.

  1. Sunka

    Sunka Well-Known Member

    What code and where to insert if I want to show user time of last activity in user block in thread (below avatar) and number of user warnings?
    And, what is conditional to show user warnings only to Staff members.

    Both info are shown in profile page block (first picture), but I want them also on user info block in threads (second picture).

    Thanks

    [​IMG]

    [​IMG]
     
  2. Amaury

    Amaury Well-Known Member

    It may require add-on to get the necessary code. I tried adding this below the homepage code in the message_user_info template to no avail:

    Code:
    <xen:if is="{$canViewOnlineStatus}">
               <dl class="pairsJustified">
                 <dl><dt>{xen:phrase last_activity}:</dt>
                 <dd><xen:datetime time="$user.effective_last_activity" /></dd></dl>
               </dl>
             </xen:if>
    
     
    Last edited: Jan 25, 2015
    Sunka likes this.
  3. Sunka

    Sunka Well-Known Member

    I have just tried and it is not showing.
    Could anyone help?
     
  4. Amaury

    Amaury Well-Known Member

     
    Sunka likes this.
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Generally speaking, if the data is not exposed to the template, it would require custom development.

    However, on dumping $user in the message_user_info template, I can see that $user.last_activity is available, as well as $user.warning_points.
     
    Sunka and Amaury like this.
  6. Sunka

    Sunka Well-Known Member

    Could you show me code which I have to put into message_user_info template?
     
  7. Dylan V

    Dylan V Well-Known Member

    Guys, you do not help saying this kind of thing.

    Go to the template "message_user_info" and replace the content with:
    Code:
    <xen:require css="message_user_info.css" />
    
    <div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
    <div class="messageUserBlock {xen:if $user.isOnline, online}">
        <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" img="true" />
                <xen:if is="{$user.isOnline}"><span class="Tooltip onlineMarker" title="{xen:phrase online_now}" data-offsetX="-22" data-offsetY="-8"></span></xen:if>
                <!-- 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, 1, 1}</xen:contentcheck></em></xen:if>
                {xen:helper userBanner, $user, 'wrapped'}
                <!-- slot: message_user_info_text -->
            </h3>
        </xen:hook>
       
        <xen:if hascontent="true">
            <div class="extraUserInfo">
                <xen:contentcheck>
                <xen:hook name="message_user_info_extra" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
                    <xen:if is="@messageShowRegisterDate AND {$user.user_id}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase joined}:</dt>
                            <dd>{xen:date $user.register_date}</dd>
                        </dl>
                    </xen:if>
               
                    <xen:if is="@messageShowMessageCount AND {$user.user_id}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase messages}:</dt>
                            <dd><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}" class="concealed" rel="nofollow">{xen:number $user.message_count}</a></dd>
                        </dl>
                    </xen:if>
               
                    <xen:if is="@messageShowTotalLikes AND {$user.user_id}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase likes_received}:</dt>
                            <dd>{xen:number $user.like_count}</dd>
                        </dl>
                    </xen:if>
               
                    <xen:if is="@messageShowTrophyPoints AND {$user.user_id}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase trophy_points}:</dt>
                            <dd><a href="{xen:link 'members/trophies', $user}" class="OverlayTrigger concealed">{xen:number $user.trophy_points}</a></dd>
                        </dl>
                    </xen:if>
           
                    <xen:if is="@messageShowGender AND {$user.gender}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase gender}:</dt>
                            <dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd>
                        </dl>
                    </xen:if>
               
                    <xen:if is="@messageShowOccupation AND {$user.occupation}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase occupation}:</dt>
                            <dd itemprop="role">{xen:string censor, $user.occupation}</dd>
                        </dl>
                    </xen:if>
               
                    <xen:if is="@messageShowLocation AND {$user.location}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase location}:</dt>
                            <dd><a href="{xen:link 'misc/location-info', '', 'location={xen:string censor, $user.location, '-'}'}" target="_blank" rel="nofollow" itemprop="address" class="concealed">{xen:string censor, $user.location}</a></dd>
                        </dl>
                    </xen:if>
           
                    <xen:if is="@messageShowHomepage AND {$user.homepage}">
                        <dl class="pairsJustified">
                            <dt>{xen:phrase home_page}:</dt>
                            <dd><a href="{xen:string censor, $user.homepage, '-'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>
                        </dl>
                    </xen:if>
               
                        <dl class="pairsJustified">
                            <dl><dt>{xen:phrase last_activity}:</dt> <xen:datetime time="$user.effective_last_activity" /></dd></dl>
                        </dl>
               
                    <xen:if is="{$canViewWarnings}">
                        <dl class="pairsJustified">
                            <dl><dt>{xen:phrase warning_points}:</dt><dd>{xen:number $user.warning_points}</dd></dl>
                        </dl>
                    </xen:if>
                           
                </xen:hook>       
                <xen:if is="@messageShowCustomFields AND {$user.customFields}">
                <xen:hook name="message_user_info_custom_fields" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
           
                    <xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
                        <xen:if is="{$fieldInfo.viewable_message} AND ({$fieldInfo.display_group} != 'contact' OR {$user.allow_view_identities} == 'everyone' OR ({$user.allow_view_identities} == 'members' AND {$visitor.user_id}))">
                            <xen:if hascontent="true">
                                <dl class="pairsJustified userField_{$fieldId}">
                                    <dt>{xen:helper userFieldTitle, $fieldId}:</dt>
                                    <dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
                                </dl>
                            </xen:if>
                        </xen:if>
                    </xen:foreach>
               
                </xen:hook>
                </xen:if>
                </xen:contentcheck>
            </div>
        </xen:if>
       
    </xen:if>
    
        <span class="arrow"><span></span></span>
    </div>
    </div>
    Screenshot_1.png
     
    Sunka likes this.
  8. Sunka

    Sunka Well-Known Member

    @Dylan V

    I managed to work out the warning points with this code (you must have waindigo mod installed):
    Code:
                <xen:comment>START Dodavanje Warning ispod avatara</xen:comment>
                                  <xen:if is="{$canViewWarnings}">
                               <dl class="pairsJustified">
                    <dt>Kartoni: </dt>
                    <dd><a href="{xen:link members, $user}#warnings" class="concealed" title="{xen:phrase waindigo_warnings_count_warning_points_warningscount}">{xen:number $warningCount}/{xen:number $user.warning_points}</a></dd>
                    </xen:if>
            <xen:comment>END Dodavanje Warning ispod avatara</xen:comment>    
    So I have not warning points, but card numbers :)

    But with another code - last activity - it is to much error. If I use your code @Dylan V all users in thread have same last activity date like me, in another word, session is copied.-
    @Mike - could you help, what is right code to copy into Message_user_info template? I need code from Profile block, but I can not go to it.
    Sorry for my not so good english
     
  9. Dylan V

    Dylan V Well-Known Member

    The code comes directly from the template "member_view" (where this element is placed).
     
  10. Sunka

    Sunka Well-Known Member

    @Dylan V, I have found that right code is:
    Code:
    <dt>Last seen:</dt>
    <dd><xen:datetime time="$user.last_activity" /></dd>
    So I have to instead $user.effective_last_activity use $user.last_activity like @Jake Bunce posted here.
    But, even if I use dl class="pairsJustified" last activity date are much bigger then others info. It is weird :confused:
    Even joined date is effected.

    Anybody knows how I can sort this out, so all letters are same size and inline if possible


    [​IMG]
     
  11. Sunka

    Sunka Well-Known Member

    Found the solution :)

    If anybody want to know how to do it, here is how:

    In the template: 'message_user_info' just after:
    Code:
            <xen:if is="@messageShowRegisterDate AND {$user.user_id}">
               <dl class="pairsJustified">
                 <dt>{xen:phrase joined}:</dt>
                 <dd>{xen:date $user.register_date}</dd>
               </dl>
             </xen:if>
    You have to insert:
    Code:
               <dl class="pairsJustified">
                 <dt>{xen:phrase last_activity}:</dt>
                 <dd>{xen:datetime $user.last_activity}</dd>
               </dl>
    And then, in style properties - Message layout increase in User Info Container width, and in Content Container increase Left Margin (y)
     

Share This Page