How to edit this plugin to display post count bigger 1 at online today and online now - MYBB onlinetoday

StackOverflow https://stackoverflow.com/questions/13334440

  •  28-11-2021
  •  | 
  •  

سؤال

I am using this plugin

http://mods.mybb.com/download/online-today-1.2.2

the below part is query

        $queries[] = $db->simple_select(
        "users u LEFT JOIN ".TABLE_PREFIX."sessions s ON (u.uid=s.uid)", 
        "s.sid, s.ip, s.time, s.location, u.uid, u.username, u.invisible, u.usergroup, u.displaygroup",
        "u.lastactive > $timesearch ORDER BY u.username ASC, s.time DESC"
    );
    $queries[] = $db->simple_select(
        "sessions s LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)",
        "s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup",
        "s.time>'$timesearch' ORDER BY u.username ASC, s.time DESC"
    );

Now i want to modify this query in order to fetch only users which has greater than 0 post count. So at least 1 post and above

thank you

php, mybb

هل كانت مفيدة؟

المحلول

Try this code:

    $queries[] = $db->simple_select(
    "users u LEFT JOIN ".TABLE_PREFIX."sessions s ON (u.uid=s.uid)", 
    "s.sid, s.ip, s.time, s.location, u.uid, u.username, u.invisible, u.usergroup, u.displaygroup",
    "u.lastactive > $timesearch AND u.postnum > 0 ORDER BY u.username ASC, s.time DESC"
    );
    $queries[] = $db->simple_select(
    "sessions s LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)",
    "s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup",
    "s.time>'$timesearch' AND u.postnum > 0 ORDER BY u.username ASC, s.time DESC"
    );

I just added an additional WHERE clause that checks the postnum field to make sure it's greater than 0.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top