XF 2.2 "Last seen" date?

Is there any way to add "Last seen" or "Last Activity" date to a member's avatar (as in past versions), instead of just in the user's member card?
 
I have the same question I think. I would like to add the last seen/last activitivy field here:

1650565092158.webp

Is this possible with custom fields somehow?

Thanks
Andreas
 
In template message_macros FIND:
HTML:
                <div class="message-userExtras">

ADD BELOW:
HTML:
                    <dl class="pairs pairs--justified">
                        <dt>{{ phrase('last_seen') }}</dt>
                        <dd dir="auto">
                            <xf:contentcheck><xf:useractivity user="$user" class="pairs--plainLabel" /></xf:contentcheck>
                        </dd>
                    </dl>
 
That's great addition. Can we get info about last post in similar way? To have both under avatar?

EDIT: Code to show only to mods and admins:

HTML:
$0

                    <xf:if is="$xf.visitor.is_admin OR $xf.visitor.is_moderator">
                        <xf:if contentcheck="true">
                            <dl class="pairs pairs--justified">
                                <dt>{{ phrase('last_seen') }}</dt>
                                <dd dir="auto">
                                    <xf:contentcheck><xf:useractivity user="$user" class="pairs--plainLabel" /></xf:contentcheck>
                                </dd>
                            </dl>
                        </xf:if>
                    </xf:if>

Taken from here: https://xenforo.com/community/threads/conditional-statements-for-xenforo-2.136639/post-1571989
 
Last edited:
That's because you have this somewhere in the code (I guess in the extra.less template):
Less:
.message-userExtras {
    display: block !important;
}

I would remove the code completely. Unless you would like to show other two fields on mobile.
 
That's because you have this somewhere in the code (I guess in the extra.less template):
Less:
.message-userExtras {
    display: block !important;
}

I would remove the code completely. Unless you would like to show other two fields on mobile.
We show the Year of Car they own and joined date and that seems to work on mobile so I would hate to get rid of it.
Screenshot_20230223_164540_Chrome.webp
 
We show the Year of Car they own and joined date and that seems to work on mobile so I would hate to get rid of it.
View attachment 281978
In that case, you can add an extra class like this:
Less:
                    <dl class="pairs pairs--justified noMobile">
                        <dt>{{ phrase('last_seen') }}</dt>
                        <dd dir="auto">
                            <xf:contentcheck><xf:useractivity user="$user" class="pairs--plainLabel" /></xf:contentcheck>
                        </dd>
                    </dl>

You can see I've added the class noMobile (you can add whatever you want to identify it). After that add this to your extra.less template:
Less:
@media (max-width: @xf-responsiveMedium) {
    .noMobile {
        display: none;
    }
}
 
Back
Top Bottom