XF 2.0 Profile link under avatar?

PumpinIron

Well-known member
I have a lot of members asking me for a direct link to the members profile under their avatar / username.

The reason for this is that often times people need to be able to view that person's profile in order to see what year of Jeep they have, what kind of transmission, etc.

This information is of course contained in that persons "About" section of their profile.

Has anyone done something like this on their forum? If so, what template did you edit, and what is the code you added? I can figure it out myself, no doubt. I just want to see what others may have done.

The forum in question is https://wranglertjforum.com
 
Edit template: message_macros

Find ..

PHP:
    <section itemscope itemtype="https://schema.org/Person" class="message-user">
        <div class="message-avatar {{ ($xf.options.showMessageOnlineStatus && $user && $user.isOnline()) ? 'message-avatar--online' : '' }}">
            <div class="message-avatar-wrapper">
                <xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />
                <xf:if is="$xf.options.showMessageOnlineStatus && $user && $user.isOnline()">
                    <span class="message-avatar-online" data-xf-init="tooltip" title="{{ phrase('online_now')|for_attr }}"></span>
                </xf:if>
            </div>

add under it..

PHP:
<a href={{ link('members', $user) . '#about' }}>View Profile</a>
 
Last edited:
just to note i typed xf.visitor but meant $user, fixed now in post above, if you want the view profile button to only show to members use..

PHP:
        <xf:if is="$xf.visitor.user_id">
            <div class="userBanner userBanner--primary message-userBanner" dir="auto" itemprop="jobTitle">
                <span class="userBanner-before"><i class="fa fa-user"></i></span>
                <a href={{ link('members', $user) . '#about' }}><strong>View Profile</strong></a>
            </div>
        </xf:if>

code shows as default banner, you can change it to whatever way you please.
 
just to note i typed xf.visitor but meant $user, fixed now in post above, if you want the view profile button to only show to members use..

PHP:
        <xf:if is="$xf.visitor.user_id">
            <div class="userBanner userBanner--primary message-userBanner" dir="auto" itemprop="jobTitle">
                <span class="userBanner-before"><i class="fa fa-user"></i></span>
                <a href={{ link('members', $user) . '#about' }}><strong>View Profile</strong></a>
            </div>
        </xf:if>

code shows as default banner, you can change it to whatever way you please.

Here's how I ended up styling mine:

189029

I just used the default XenForo button syntax for that, so no custom CSS was needed.

It looks great on mobile too.

Members kept asking me for this, because they want to easily be able to view other members' profiles which sometimes helps when trying to diagnose technical problems (since their profiles have a bunch of custom fields that they fill out).
 
Here's how I ended up styling mine:

View attachment 189029

I just used the default XenForo button syntax for that, so no custom CSS was needed.

It looks great on mobile too.

Members kept asking me for this, because they want to easily be able to view other members' profiles which sometimes helps when trying to diagnose technical problems (since their profiles have a bunch of custom fields that they fill out).

I checked your forum, it's showing 0 id for me, for all users, i guess that's a permission thing for guests, why i said show it only to logged in members
 
I checked your forum, it's showing 0 id for me, for all users, i guess that's a permission thing for guests, why i said show it only to logged in members

Oh yes, I forgot to add that bit of code that will only show the button to members. I’ll go back and do that. I appreciate that input!
 
Top Bottom