XF 1.2 Members on line (alphabetical order)

It's possible with a very simple code edit:

Open the file: library/XenForo/Model/Session.php

Find:

PHP:
public function getSessionActivityQuickList(array $viewingUser, array $conditions = array(), array $forceInclude = null)

Shortly below that you'll see:

PHP:
        $fetchOptions = array(
            'join' => self::FETCH_USER,
            'order' => 'view_date'
        );

Change 'view_date' to 'username'.
 
It's possible with a very simple code edit:

Open the file: library/XenForo/Model/Session.php

Find:

PHP:
public function getSessionActivityQuickList(array $viewingUser, array $conditions = array(), array $forceInclude = null)

Shortly below that you'll see:

PHP:
        $fetchOptions = array(
            'join' => self::FETCH_USER,
            'order' => 'view_date'
        );

Change 'view_date' to 'username'.
Will try shortly. And on your add on "members who visited in the last 24 hrs"? :D
 
It's possible with a very simple code edit:

Open the file: library/XenForo/Model/Session.php

Find:

PHP:
public function getSessionActivityQuickList(array $viewingUser, array $conditions = array(), array $forceInclude = null)

Shortly below that you'll see:

PHP:
        $fetchOptions = array(
            'join' => self::FETCH_USER,
            'order' => 'view_date'
        );

Change 'view_date' to 'username'.
Worked! Thanks @Chris Deeming!
 
Yes, it's the same premise.

Almost exactly the same, actually.

I think the file is WhoHasVisited/Model/WhoHasVisited.php

I'm sure you'll find it.
 
I didn't fine the exact code as you mentioned above. Do you see anything here that would do the trick?
Yes, it's the same premise.

Almost exactly the same, actually.

I think the file is WhoHasVisited/Model/WhoHasVisited.php

I'm sure you'll find it.
Code:
<?php



class WhoHasVisited_Model_WhoVisited extends XenForo_Model

{

    public function updateWhoVisitedCache()

    {

        $whoVisited = $this->getWhoVisited();

       

        XenForo_Application::setSimpleCacheData('whoHasVisited', $whoVisited);

       

        return $whoVisited;

    }

   

    public function getWhoVisited()

    {

        $timeRange = $this->getTimeRange();

       

        $users = $this->fetchAllKeyed("

            SELECT

                user.user_id, user.username,

                user.avatar_date, user.last_activity,

                user.visible, user.is_banned,

                user.display_style_group_id, activity.view_date

            FROM xf_user AS user

            LEFT JOIN xf_session_activity AS activity ON

                (user.user_id = activity.user_id)

            WHERE last_activity BETWEEN

                $timeRange[from] AND $timeRange[to]

            ORDER BY last_activity DESC

        ", 'user_id');

       

        $whoHasVisited = array(

            'time' => XenForo_Application::$time,

            'users' => $users,

        );

       

        foreach ($whoHasVisited['users'] AS &$user)

        {

            $user['last_activity'] = $user['view_date'] > $user['last_activity'] ? $user['view_date'] : $user['last_activity'];

        }

       

        return $whoHasVisited;

    }

   

    public function getWhoVisitedFromCache()

    {

        $options = XenForo_Application::get('options');

        $currentTime = XenForo_Application::$time;

       

        if ($options->whoHasVisitedCached)

        {

            $whoHasVisited = XenForo_Application::getSimpleCacheData('whoHasVisited');

           

            if (empty($whoHasVisited))

            {

                return $this->updateWhoVisitedCache();

            }

           

            if (!empty($whoHasVisited['time']) && ($currentTime - $whoHasVisited['time']) <= ($options->whoHasVisitedCached * 60))

            {

                return $whoHasVisited;

            }

           

            return $this->updateWhoVisitedCache();

        }

       

        return $this->getWhoVisited();

    }   

   

    public function getTimeRange()

    {

        $options = XenForo_Application::get('options');

       

        $timeRange = array(

            'to' => XenForo_Application::$time,

            'from' => XenForo_Application::$time - ($options->whoHasVisitedHours * 60 * 60)

        );

       

        return $timeRange;

    }

   

    public function prepareWhoHasVisited(array $whoHasVisited)

    {

        foreach ($whoHasVisited['users'] AS $key => &$user)

        {

            if (!$this->getModelFromCache('XenForo_Model_User')->canBypassUserPrivacy())

            {

                if (!$user['visible'])

                {

                    unset($whoHasVisited['users'][$key]);

                }

               

                if ($user['is_banned'])

                {

                    unset($whoHasVisited['users'][$key]);

                }                   

            }

        }

       

        $options = XenForo_Application::get('options');

       

        $whoHasVisited['count'] = count($whoHasVisited['users']);

       

        $whoHasVisited['display_users'] = array_slice($whoHasVisited['users'], 0, $options->whoHasVisitedLimit, true);

        $whoHasVisited['display_count'] = count($whoHasVisited['display_users']);

       

        $whoHasVisited['hide_users'] = array_slice($whoHasVisited['users'], $options->whoHasVisitedLimit, NULL, true);

        $whoHasVisited['hide_count'] = count($whoHasVisited['hide_users']);

       

        return $whoHasVisited;

    }

   

    public function canViewWhoVisited(array $viewingUser = null)

    {

        $this->standardizeViewingUserReference($viewingUser);

       

        $userGroups = XenForo_Application::get('options')->whoHasVisitedGroup;

       

        return $this->getModelFromCache('XenForo_Model_User')->isMemberOfUserGroup($viewingUser, $userGroups);

    }

}
 
Yeah... I would ask you to get it from the Server Error log in the Admin CP, but I don't why you would get an error there so it would be good to see if that error still happens.
 
Could you get the error out of the Server Error log in the Admin CP?

I'm still intrigued!

Sorry, my bad.

Change:

PHP:
ORDER BY user.username DESC

to

PHP:
ORDER BY user.username ASC
 
Top Bottom