Viewing 12 replies - 1 through 12 (of 12 total)
  • I have the same problem

    I want to report the same issue ??

    Reporting the same issue…

    After looking into the issue, I believe that it’s not properly sorting because users who have not logged in since you’ve installed the plugin don’t actually have the wp-last-login value stored in the database table, so it has nothing to compare too in the query.

    Setting the last login value to 0, when the user hasn’t logged in would probably resolve the issue, but I didn’t feel like hacking up the plugin code. Hopefully Konstantine will get around to making the adjustments.

    ‘request’ hook do not works in users.php

    I use this fonction to workaround :

    add_action('pre_user_query', function ($query){
       $vars = $query->query_vars;
       if ( isset( $vars['orderby'] ) && 'wp-last-login' == $vars['orderby'] ) {
          global $wpdb;
          $query->query_from .= " LEFT OUTER JOIN $wpdb->usermeta AS alias ON ($wpdb->users.ID = alias.user_id) ";
          $query->query_where .= " AND alias.meta_key = 'wp-last-login' ";
          $query->query_orderby = " ORDER BY alias.meta_value+0 " // +0 for num order
                      .($query->query_vars["order"] == "ASC" ? "asc " : "desc ");//set sort order
       }
    });

    And, when I instal WPLL on an old site, to sort never connected, i run this SQL too:

    INSERT INTO wp_usermeta ( user_id, meta_key, meta_value)
    SELECT ID, 'wp-last-login', 0 FROM wp_users
    WHERE ID NOT IN (SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp-last-login')

    Wow, I wish I would have found this an hour ago. I just worked out the same solution.
    by the way, if you want a remixed version that includes this fix, you can download it here: https://plugins.twinpictures.de/fixed-plugins/wp-last-login/

    Thank you for the link Baden ! It works perfectly !!

    It can even help me to finish my plugin (I had the same problem with date sorting ^^)

    Hi guys. The sorting option doesn’t work for me. I’m running WP 4.0.1. Even tried to install the version by Baden, doesn’t work. The version by Baden returns: No matching users were found. – when I click the sorting button. Sad. Any ideas?

    any new ideas on this one?!

    Plugin Author Konstantin Obenland

    (@obenland)

    Released an update today.
    Please let me know if it didn’t fix the issue for you.

    Hello Konstantin.
    Thank for the plugin. Could you please look at this post?

    https://www.ads-software.com/support/topic/column-sort-not-working?replies=21#post-4463817

    Can you make the function as described in that post? Very useful. Thanks

    The automatic schedule is working with old version. Have not tested yet with new version.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘WP 4.0 Sorting by date doesn't work!’ is closed to new replies.