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

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

Discussion in 'XenForo Development Discussions' started by Sagar, Nov 30, 2010.

  1. Sagar

    Sagar Active Member

    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="$activeUsersvalue="$user">
                        <
    li><xen:avatar user="$usersize="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="$latestUsersvalue="$user">
                        <
    li><xen:avatar user="$usersize="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>
     
    erich37 likes this.
  2. Shadab

    Shadab Well-Known Member

    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.
     
    Floris likes this.
  3. Floris

    Floris Guest

    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.
     
  4. swatme

    swatme Well-Known Member

    hi what specific codes should i add on sidebar?
    i want to show on sidebar the highest posting members
     
  5. borbole

    borbole Well-Known Member

Share This Page