• I’ve got the latest WP installed and had the wp-useronline plugin working fine until the other day when I installed the copperminesc plugin.

    Now, the useronline sometimes shows me “0 users online” (even if I’m visiting the page) and when I click on it, to take me to the actual users online page, it gives me the following message:

    Warning: Invalid argument supplied for foreach() in /mnt/web_k/d38/s32/a0004tng/www/talk/wp-useronline.php on line 37

    Line 37 is around this code:
    // Check Members
    if(isset($_COOKIE['comment_author_'.$cookiehash])) {
    $memberonline = trim($_COOKIE['comment_author_'.$cookiehash]);
    [THIS IS LINE 37 ON MY COMPUTER]$where = "WHERE username='$memberonline'";[ENDS HERE]
    // Check Guests
    } else {
    $memberonline = 'Guest';
    $where = "WHERE ip='".get_IP()."'";
    }

    But if I refresh the useronline page itself, after I get that message, then the first error code seems to disappear.

    Does anyone know what’s going on, or how I can fix this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter jafer

    (@jafer)

    Anybody even thinking “I dunno”?

    Thread Starter jafer

    (@jafer)

    Does anyone have a clue about this? Right now I’ve had to remove the wp-useronline plugin.

    I don’t have the plugin in front of me, but I can be pretty sure that’s not the line causing the problem.

    Are there any include or require lines earlier in the file? PHP line numbers are pretty useless if any files are included before the error occurs.

    Thread Starter jafer

    (@jafer)

    Well below is the entire plugin, I didn’t make any changes to it:

    <?php
    /*
    Plugin Name: Useronline
    Plugin URI: http://www.lesterchan.net/portfolio/programming.php
    Description: Adds A Useronline Feature To WordPress
    Version: 1.2
    Author: GaMerZ
    Author URI: http://www.lesterchan.net
    */

    function get_IP() {
    if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
    $ip_address = $_SERVER["REMOTE_ADDR"];
    } else {
    $ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
    }
    if(strpos($ip_address, ',') !== false) {
    $ip_address = explode(',', $ip_address);
    $ip_address = $ip_address[0];
    }
    return $ip_address;
    }

    function useronline($user = 'User', $users = 'Users') {
    global $wpdb, $tableuseronline, $cookiehash;
    // Search Bots
    $bots = array('Google Bot' => 'googlebot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'ask jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'inktomi', 'Turnitin.com' => 'turnitinbot');

    // Useronline Settings
    $timeoutseconds = 300;
    $timestamp = time();
    $timeout = $timestamp-$timeoutseconds;

    // Check Members
    if(isset($_COOKIE['comment_author_'.$cookiehash])) {
    $memberonline = trim($_COOKIE['comment_author_'.$cookiehash]);
    $where = "WHERE username='$memberonline'";
    // Check Guests
    } else {
    $memberonline = 'Guest';
    $where = "WHERE ip='".get_IP()."'";
    }
    // Check For Bot
    foreach ($bots as $name => $lookfor) {
    if (strpos($_SERVER['HTTP_USER_AGENT'], $lookfor) !== false) {
    $memberonline = $name;
    $where = "WHERE ip='".get_IP()."'";
    }
    }
    // Make Page
    $make_page = addslashes(single_post_title('', false));
    if(empty($make_page)) {
    $make_page = addslashes(get_bloginfo('sitename'));
    }
    // Update User First
    $update_user = $wpdb->query("UPDATE $tableuseronline SET timestamp='$timestamp',ip='".get_IP()."',location='$make_page',url='".$_SERVER['REQUEST_URI']."' $where");
    // If No User Insert It
    if(!$update_user) {
    $insert_user = $wpdb->query("INSERT INTO $tableuseronline VALUES ('$timestamp','$memberonline','".get_IP()."','$make_page','".$_SERVER['REQUEST_URI']."')");
    }

    $delete_users = $wpdb->query("DELETE FROM $tableuseronline WHERE timestamp<$timeout");
    $useronline = $wpdb->get_var("SELECT COUNT(*) FROM $tableuseronline");
    if($useronline > 1) {
    $useronline = "<b>$useronline</b> $users Online";
    } else {
    $useronline = "<b>$useronline</b> $user Online";
    }
    return $useronline;
    }
    ?>

    And it used to work until I put on the coppermine plugin.

    The coppermine plugin is using a separate database that I have for my pictures.

    Thread Starter jafer

    (@jafer)

    Remember this question about getting the users online plugin working again?

    Thread Starter jafer

    (@jafer)

    I’ve reactivated the user online plugin as of today, and not only did I get the warning at the top of the page when it showed me 0 users online (even though I was at the site), but it also showed me at this page:

    #1 – jafer (24.42.55.116) on 26.09.2005 @ 21:38
    Idiot on a Stick » Blog Archive » Error [url]

    I was not on an error page, I was actually on the main index.php page, and yet it showed as if I was on an error page.

    Does anybody know anything about this and why it’s doing this? It’s been two weeks since I first posted this problem, and I don’t have a clue about php or plugins.

    Have you tried contacting the author of the plugin?

    Thread Starter jafer

    (@jafer)

    Actually I hadn’t because I couldn’t find any way to contact him on his site, but then I just went back and saw that his resume is there, with an email address, and so I will try to email him to see if I can get any response there.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Coppermine & Useronline Plugins’ is closed to new replies.