Add ACP options for following and followers count on profile pages

Brogan

XenForo moderator
Staff member
The following and followers count are currently hard coded in library/XenForo/ControllerPublic/Member.php like so:

Code:
$followingToShowCount = 6;
 
...
 
$followers = $userModel->getUsersFollowingUserId($userId, 6, 'RAND()');

It doesn't make much sense being able to increase the sidebar width in Style Properties: Member Profile Page -> Settings -> Sidebar Width if those values are hard coded, as the blocks look incomplete.

I have increased the width of the sidebar to 246px to accomodate YouTube videos - videos less than 230px with adverts won't display, due to new Google rules.
Therefore I have had to manually edit the file to achieve the desired result, which is:

following-followers.PNG
 
Upvote 16

Sage Knight

Well-known member
Just today I was looking for such a thing, it's a bit surprising to see it hard coded to 6 when sidebar lengths vary from forum to forum.
 
I need this for Xenforo 2. Does anyone know an addon or how to style it to where i can display my member's followers and following on the member view?
 

kick

Well-known member
e.g
Code:
<xf:foreach loop="$xf.app.em.getRepository('XF:UserFollow').findFollowersForProfile($user).fetch()" value="$follow">
    {{ $follow.User.username }}
</xf:foreach>
 

kick

Well-known member
e.g
1589453397259.png
HTML:
<xf:sidenav>
    <div class="block">
        <div class="block-container">
            <xf:if contentcheck="true">
                <div class="block-row block-row--separated">
                    <h4 class="block-textHeader">{{ phrase('member_is_following') }}</h4>
                    <ul class="listHeap">
                        <xf:contentcheck>
                            <xf:foreach loop="$user.Following" value="$followingUser"
                                        if="!$xf.visitor.isIgnoring($followingUser.user_id)">
                                <li>
                                    <xf:avatar user="$followingUser.FollowUser" size="s"/>
                                </li>
                            </xf:foreach>
                        </xf:contentcheck>
                    </ul>
                </div>
            </xf:if>
        </div>
    </div>
</xf:sidenav>

<xf:sidenav>
    <div class="block">
        <div class="block-container">
            <xf:if contentcheck="true">
                <div class="block-row block-row--separated">
                    <h4 class="block-textHeader">{{ phrase('followers') }}</h4>
                    <ul class="listHeap">
                        <xf:contentcheck>
                            <xf:foreach loop="$xf.app.em.getRepository('XF:UserFollow').findFollowersForProfile($user).fetch(12)" value="$followerUser" if="!$xf.visitor.isIgnoring($followerUser.follow_user_id)">
                                <li>
                                    <xf:avatar user="$followerUser.User" size="s" />
                                </li>
                            </xf:foreach>
                        </xf:contentcheck>
                    </ul>
                </div>
            </xf:if>
        </div>
    </div>
</xf:sidenav>
 

Brogan

XenForo moderator
Staff member
This suggestion is no longer relevant as XF2 doesn't have those blocks in the sidebar.

It now appears like this:
1600360044229.png
 
Top