Fork me on GitHub

CS_Buddies bug fix  Bottom

  • I didn't see this posted already, so I'll add it in case anyone else finds it useful.

    Bug: Privmsgs counts appear at the top of the block as well as to the right of the logged in user. The privmsgs count paratheses appear next to logged in member usernames when they should not.

    Fix:
    1. Open pnuserapi.php

    2. Go to line 691

    3. Replace:

    // displays sendprv and addtobuddy only if not itself
    // otherwise show the priv messages status
    if ($uid != $userid) {
    $onlinemembers .= "\""._CSB_SENDPRIVMSG."\""
    . " $uid, "bid" => $userid, "bname" => $username)). "\">\""._CSB_ADDBUDDYMEMBER."\"";
    }
    else {
    $column = &$pntable['priv_msgs_column'];
    $result = $dbconn->Execute("SELECT COUNT(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]='$uid'");
    list($numrow) = $result->fields;

    $result = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]='$uid' AND $column[read_msg]='0'");
    list($newmsgs) = $result->fields;

    if($newmsgs > 0)
    $onlinemembers .= "\""._CSB_NEWPRIVATEMSG."\"";
    else
    $onlinemembers .= "\""._CSB_PRIVATEMSG."\"";
    }
    $onlinemembers .= " <small>($newmsgs/$numrow)</small>";

    $onlinemembers .= "";
    $onlinemembers .= "";


    4. With:


    // displays sendprv and addtobuddy only if not itself
    // otherwise show the priv messages status
    if ($uid != $userid) {
    $onlinemembers .= "\""._CSB_SENDPRIVMSG."\""
    . " $uid, "bid" => $userid, "bname" => $username)). "\">\""._CSB_ADDBUDDYMEMBER."\"";
    }
    else {
    $column = &$pntable['priv_msgs_column'];
    $result = $dbconn->Execute("SELECT COUNT(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]='$uid'");
    list($numrow) = $result->fields;

    $result = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]='$uid' AND $column[read_msg]='0'");
    list($newmsgs) = $result->fields;

    if($newmsgs > 0) {
    $onlinemembers .= "\""._CSB_NEWPRIVATEMSG."\"";
    }
    else{
    $onlinemembers .= "\""._CSB_PRIVATEMSG."\"";
    }
    $onlinemembers .= " <small>($newmsgs/$numrow)</small>";
    }

    $onlinemembers .= "";
    $onlinemembers .= "";
  • thanks for this indy, looked for ages but couldn't find it. Dont suppose you figured the guest counter problem, seems to be counting too many visitors...any ideas anyone?
  • OK So I have fixed this problem using the above code.
    And have applied the time hack http://forums.postnu…7352&highlight=hack

    Now the core PM shows the correct time but cs_buddies block doesn't seem to take into account the time offset. Any ideas anyone?

This list is based on users active over the last 60 minutes.