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

Fixed AdminCP user IP Address list is not sorted as expected

Discussion in 'Resolved Bug Reports' started by Xon, Dec 31, 2015.

  1. Xon

    Xon Well-Known Member

    Ordering of IPs isn't matching the expected 'ORDER BY log_date DESC' inside XenForo_Model_Ip::getIpsByUserId

    I've had this happening with MariaDB 5.x, 10.0.x, 10.1.x;


    This user does have some IPv6 addresses (off screen somewhere).
    Last edited: Dec 31, 2015
  2. Xon

    Xon Well-Known Member

    The bug is with the MAX(log_date) vs the ORDER BY clause:
      SELECT MAX(log_date), ip
      FROM xf_ip
      WHERE user_id = ?
      GROUP BY ip
      ORDER BY log_date DESC
    This sorts from newest to oldest, but only displays the oldest logged date.

    This means if someone switches devices and back again, the most recent IP is stuck down on the list somewhere.
    Last edited: Dec 31, 2015
  3. Mike

    Mike XenForo Developer Staff Member

    Sorting by the MAX(log_date) should be acceptable/valid and makes the order more predictable at least.
    Xon likes this.

Share This Page