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

XF 1.4 New Members Block > Notable members?

Discussion in 'Styling and Customization Questions' started by Glockie, Jun 9, 2015.

  1. Glockie

    Glockie Well-Known Member


    I do hope I have posted this in the right section?

    Following some guides here and some help from another member, I have made a good start on adding a new tab under the 'notable members' section.

    So it now lists members but only one page and from a-z so that means it's actually listing older members as well as new members.. Grr

    What I would like to do, and I have all the code in front of me now but it's proving challenging, is basically put the new members block - code, into a tab on the notable members, and list about 24 members which is what I currently show.

    Is this possible?
    I did add them into a link (li) but the div didn't nest quite right as the tooltip and avatar threw it all out.
    I would be very grateful if someone knows how to do this..
    I will include the bits to show what I have done so far.

    So from this snippet;

        $latestUsers = $userModel->getLatestUsers($memberCriteria, array('limit' => 24));
            $viewParams = array(
                'userNotFound' => $userNotFound,
                'users' => $users,
                'type' => $type,
                'bigKey' => $bigKey,
                'birthdays' => $birthdays,
                'latestUsers' => $latestUsers

    I made this;
    <ul class="tabs">
       <li class="{xen:if '{$type} == "messages"', active}"><a href="{xen:link members}">{xen:phrase most_messages}</a></li>
       <li class="{xen:if '{$type} == "likes"', active}"><a href="{xen:link members, '', 'type=likes'}">{xen:phrase most_likes}</a></li>
       <li class="{xen:if '{$type} == "points"', active}"><a href="{xen:link members, '', 'type=points'}">{xen:phrase most_points}</a></li>
       <li class="{xen:if '{$type} == "staff"', active}"><a href="{xen:link members, '', 'type=staff'}">{xen:phrase staff_members}</a></li>
       <!--<li class="{xen:if '{$type} == "getlatestUsers"', active}"><a href="{xen:link members, '', 'type=getlatestUsers'}">New Members</a></li>
       <li class="{xen:if '{$type} == "getlatestUsers"', active}"><a href="{xen:link members, '', 'type=getlatestUsers'}">
       <xen:if is="{$latestUsers}">
       <h3>{xen:phrase newest_members}</h3>
         <xen:foreach loop="$latestUsers" value="$user">
         <li><xen:avatar user="$user" size="s" text="{$user.username} ({xen:datetime $user.register_date})" title="{$user.username}, {xen:phrase joined}: {xen:datetime $user.register_date}" /></li>

    along with;

       protected function _getNotableMembers($type, $limit)
         $userModel = $this->_getUserModel();
         $notableCriteria = array(
           'is_banned' => 0
         if ($type == 'getlatestUsers')
           $memberCriteria['secondary_group_ids'] = array(3);
         $typeMap = array(
           'messages' => 'message_count',
           'likes' => 'like_count',
           'points' => 'trophy_points',
           'getlatestUsers' => 'join_date'
         if (!isset($typeMap[$type]))
           return false;
         $field = $typeMap[$type];
         $notableCriteria[$field] = array('>', 0);
         return array($userModel->getUsers($notableCriteria, array(
           'join' => XenForo_Model_User::FETCH_USER_FULL,
           'limit' => $limit,
           'order' => $field,
           'direction' => 'desc'
         )), $typeMap[$type]);

    It works, but is extremely messy and let's be honest, it's messy coding.
    Ideally all I want is to list newest members widget content, into a tab on notable members.
    There's got to be an easier, cleaner and better way to do it than what I am doing..

    I hope anyway.
    Many thanks.

    Basically this block and code /content

    into the tab like that; this is the tab I have made so far, which does list members but not as we would like..

  2. Glockie

    Glockie Well-Known Member

    Okay I have since found that I need to use a usermodel function is it?

    Was kind of hoping I could pop the code into the tab section in members.php and it would work.
    It's almost staring me in the face but once you get tunnel vision it's hard to get out of it..
    Does Xenforo still call from the usermodel as mentioned in that thread?

    Oh also I found this, will this help?

    :eek: :confused:

Share This Page