Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • `
    define(‘DB_SERVER’, DB_HOST );
    define(‘DB_PORT’, ‘3306’ );
    define(‘DB_USERNAME’, DB_USER );
    define(‘TABLE_PREFIX’, ‘wp_’ );
    define(‘DB_USERTABLE’, ‘users’ );
    define(‘DB_USERTABLE_NAME’, ‘display_name’ );
    define(‘DB_USERTABLE_USERID’, ‘ID’ );
    define(‘DB_USERTABLE_LASTACTIVITY’, ‘lastactivity’ );

    function getUserID() {
    global $current_user;
    get_currentuserinfo();

    $userid = 0;

    if (!empty($current_user->ID)) {
    $userid = $current_user->ID;
    }

    return $userid;
    }
    `

    EXECUTE MYSQL
    `
    ALTER TABLE wp_users ADD COLUMN ‘lastactivity’ INT default 0
    `

    `
    $sql = (“(select DISTINCT “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” userid, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_NAME.” username, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” lastactivity, CONCAT(“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.”,’|’,”.TABLE_PREFIX.DB_USERTABLE.”.user_email) avatar, “.TABLE_PREFIX.DB_USERTABLE.”.user_nicename link, cometchat_status.message, cometchat_status.status from “.TABLE_PREFIX.”bp_friends join “.TABLE_PREFIX.DB_USERTABLE.” on “.TABLE_PREFIX.”bp_friends.friend_user_id = “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” left join cometchat_status on “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” = cometchat_status.userid where “.TABLE_PREFIX.”bp_friends.initiator_user_id = ‘”.mysql_real_escape_string($userid).”‘ and is_confirmed = 1)

    union

    (select DISTINCT “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” userid, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_NAME.” username, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” lastactivity, CONCAT(“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.”,’|’,”.TABLE_PREFIX.DB_USERTABLE.”.user_email) avatar, “.TABLE_PREFIX.DB_USERTABLE.”.user_nicename link, cometchat_status.message, cometchat_status.status from “.TABLE_PREFIX.”bp_friends join “.TABLE_PREFIX.DB_USERTABLE.” on “.TABLE_PREFIX.”bp_friends.initiator_user_id = “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” left join cometchat_status on “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” = cometchat_status.userid where “.TABLE_PREFIX.”bp_friends.friend_user_id = ‘”.mysql_real_escape_string($userid).”‘ and is_confirmed = 1 )
    order by username asc
    “);

    if (defined(‘DISPLAY_ALL_USERS’) && DISPLAY_ALL_USERS == 1) {

    $sql = (“select DISTINCT “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” userid, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_NAME.” username, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” lastactivity, CONCAT(“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.”,’|’,”.TABLE_PREFIX.DB_USERTABLE.”.user_email) avatar, “.TABLE_PREFIX.DB_USERTABLE.”.user_nicename link, cometchat_status.message, cometchat_status.status from “.TABLE_PREFIX.DB_USERTABLE.” left join cometchat_status on “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” = cometchat_status.userid where “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” ‘”.mysql_real_escape_string($userid).”‘ and (‘”.$time.”‘-“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” < '".((ONLINE_TIMEOUT)*2)."') order by username asc");

    }

    return $sql;
    `

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar