How to add Highest Posting and Newest Members block on Home Page?

Sagar

Active member
#1
I would like to add Highest Posting Members and Newest Members blocks (which by default are shown on Members page) to forum page. I tried by copying side bar divs for both on home page sidebar but it just gave the heading and block with no users displayed.

This is the code I copied to forum list sidebar. Any idea what I am missing?

PHP:
    <div class="section activeMembers">
        <div class="secondaryContent avatarHeap">
            <h3>{xen:phrase highest_posting_members}</h3>

            <ol>
                <xen:foreach loop="$activeUsers" value="$user">
                    <li><xen:avatar user="$user" size="s" text="{$user.username} ({xen:number $user.message_count})" class="Tooltip" title="{$user.username}, {xen:phrase messages}: {xen:number $user.message_count}" /></li>
                </xen:foreach>
            </ol>
        </div>
    </div>

    <div class="section newestMembers">
        <div class="secondaryContent avatarHeap">
            <h3>{xen:phrase newest_members}</h3>

            <ol>
                <xen:foreach loop="$latestUsers" value="$user">
                    <li><xen:avatar user="$user" size="s" text="{$user.username} ({xen:datetime $user.register_date})" class="Tooltip" title="{$user.username}, {xen:phrase joined}: {xen:datetime $user.register_date}" /></li>
                </xen:foreach>
            </ol>
        </div>
    </div>
 

Shadab

Well-known member
#2
Turn on the debug mode (if developing on a local machine). You'll notice that $activeUsers and $latestUsers are not available on the forum home (forum_view) template, so a simple copy-paste of template code isn't sufficient to make it work.

This would require you to extend the controller XenForo_ControllerPublic_Index and make these two variables available yourself.
 
F

Floris

Guest
#3
Turn on the debug mode (if developing on a local machine). You'll notice that $activeUsers and $latestUsers are not available on the forum home (forum_view) template, so a simple copy-paste of template code isn't sufficient to make it work.

This would require you to extend the controller XenForo_ControllerPublic_Index and make these two variables available yourself.
Great explanation, thank you for taking the time. This helped me resolve one of my own questions I was just searching for on this site.
 
Top