Search

bbPress Showcase » Plugins by _ck_

Mini Tracks Plugin Problem

RSS

Tags:


  1. luckydost
    luckydost

    member
    Joined: Sep '08
    Posts: 17

    offline

    Hello Dear CK, First Thanks For Great Plugin. I have two problem.
    I have installed this plugin at forum. plugin working but Flags not display.
    footer.php>> Coding
    <div id="footer">
    <?php mini_track(1); // who's online now ?>
    <?php mini_track_today(1); // who's been online today ?>
    <?php mini_track_statistics(2); // general statistics ?>
    <p><?php printf(__('%1$s is proudly powered by bbPress.'), bb_option('name'), "http://bbpress.org") ?></p>

    mini-track.php>> Coding
    $mini_track_options['geoip'] = false; // "/my-plugins/ip2c"; // cc lookup -> false | mysql | ip2c
    $mini_track_options['flags'] = false; // "/my-plugins/images/flags"; // false // images instead of cc - path to flags

    $mini_track_options['debug'] = false; // false // true = shows more info when you hover over IP in display panel - makes saved data very large, don't use regularly

    $mini_track_options['topic_views'] = true; // true = replace bb-topic-views plugin, works better as no sessions needed

    $mini_track_options['auto_rdns']=true; // automatically do lazy lookups of hosts from ip when in realtime tracking display
    $mini_track_options['dns']=array("127.0.0.1"); // or change to ("208.67.220.220","208.67.222.222"); // opendns

    Please Check URL: Mobi11.com - Forum

    Here following error occur>> "Warning: Invalid argument supplied for foreach() in /home/mobi11c/public_html/forum/mini-track-admin.php on line 334"

    Please help me...!

    Waiting for reply...!

    Posted 3 years ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    mini-track should be in it's own plugin folder under my-plugins

    that error message shows it's in the main folder?

    line 334 deals with the statistics functions, it can't find any days

    I recently improved the function but I have not released it yet.

    You can try editing the file and replacing the function with this:

    function mini_track_graphs() {
    add_action('bb_head','mini_track_graphs_header',100);
    global $bbdb, $mini_track, $mini_track_today;
    $time=time();
    $gmt_offset=bb_get_option("gmt_offset")*3600;
    $today=gmdate("n/j",$time+$gmt_offset);
    $monthago=$time+$gmt_offset-(31*24*3600);
    $maxheight=100;
    
    $label[1]=__("Daily Peak Users Online At Once");
    $label[2]=__("Daily Total Page Views");
    $label[3]=__("Daily Total Posts");
    $label[4]=__("Daily Total Registrations");
    
    $day=$time+gmt_offset; // $monthago;
    do {						// for ($i=1; $i<=31; $i++) {		// prep zero fill for empty days
    $empty[date('Y-m-d',$day)]->time=$day;
    $empty[date('Y-m-d',$day)]->posts=0;
    $empty[date('Y-m-d',$day)]->views=0;
    $empty[date('Y-m-d',$day)]->users=0;
    $day=$day-24*3600;
    } while ($day>$monthago);
    $empty=array_reverse($empty);
    
    bb_get_header();
    echo '<h3 class="bbcrumb"><a href="'.bb_get_option('uri').'">'.bb_get_option('name').'</a> &raquo; '.__('Statistics').'</h3>';
    
    for ($loop=1; $loop<=4; $loop++) {
    
    if ($loop==1) {
    $query="SELECT <code>time</code>,<code>data</code> FROM mini_track WHERE <code>time</code> > $monthago ORDER BY <code>time</code> ASC LIMIT 31";
    @$days=$bbdb->get_results($query);
    
    foreach ($days as $day) {
    $result->time=$day->time;	// must be first
    $day=unserialize($day->data);
    $result->users=$day->users;
    $result->views=array_sum($day->views);
    $results[]=$result;
    }
    unset($days); // clear old data, then add today's stats
    $result->time=$mini_track_today->time;
    $result->users=$mini_track_today->users;
    $result->views=array_sum($mini_track_today->views);
    $results[]=$result;
    }
    elseif ($loop==3) {
    // posts per day
    $query="SELECT count(*) as posts, UNIX_TIMESTAMP(post_time) as time FROM $bbdb->posts WHERE post_status=0  AND UNIX_TIMESTAMP(post_time)>$monthago GROUP BY DATE(post_time) ORDER BY post_time ASC LIMIT 31";
    @$results=$bbdb->get_results($query);
    }
    elseif ($loop==4) {
    // registrations per day
    $query="SELECT count(*) as users, UNIX_TIMESTAMP(user_registered) as time FROM $bbdb->users WHERE user_status=0  AND UNIX_TIMESTAMP(user_registered)>$monthago GROUP BY DATE(user_registered) ORDER BY user_registered ASC LIMIT 31";
    @$results=$bbdb->get_results($query);
    }
    
    // make missing days have zero results
    unset($fill); foreach ($results as $result) {$fill[date('Y-m-d',$result->time)]=$result;} $results=array_merge($empty,$fill);
    
        $count=0; unset($values); unset($labels); unset($colors);
        foreach ($results as $result) {
    	        if ($loop==1) {$values[$count]=$result->users;}
    	elseif ($loop==2) {$values[$count]=$result->views;}
        	elseif ($loop==3) {$values[$count]=$result->posts;}
        	elseif ($loop==4) {$values[$count]=$result->users;}	
    
        	$labels[$count]=gmdate("n/j",$result->time+$gmt_offset);
        	if ($labels[$count]==$today) {$colors[$count]="#bbb";}     // #7799aa
        	$count++;
        }
        $peak=$values; arsort($peak); $peak=array_keys($peak);
        $colors[$peak[0]]="#cc0000";
        $colors[$peak[1]]="#0000cc";
        $colors[$peak[2]]="#00cc00";
        $multiply=round($maxheight/(0.0001+$values[$peak[0]]),2);
        $width=round(100/($count+0.0001),2); if ($width<1) {$width=1;} elseif ($width>100) {$width=50;}
    
    $output= "<br clear='both'><h3 align='center'>$label[$loop]</h3>\n<table class='mini_track_graph'>";
    $output.="<tr valign='bottom'>";
    foreach (array_keys($values) as $count)  {
    	$output.="<td width='$width%'>";
    	// if ($values[$count]>$values[$peak[20]]) {$output.="$values[$count]<div";} else {$output.="<div title='$values[$count]'";}
    	if ($values[$count]) {$output.="$values[$count]";}
    	$output.="<div style='height:".(1+$multiply*$values[$count])."px;"; //
    	if (isset($colors[$count])) {$output.="background:$colors[$count];";}
    	$output.="'> </div></td>";
    }
    $output.="</tr>";
    
    $output.="<tr class='alt'>";
    foreach (array_keys($values) as $count)  {
    // if ($values[$count]>$values[$peak[20]]) {$output.="<td>$labels[$count]</td>";} else {$output.="<td title='$labels[$count]'> </td>";}
    $output.="<td>$labels[$count]</td>";
    }
    $output.="</tr>";
    
    $output.= "</table><br clear='both'>\n";
    
    echo $output;
    
    }	//  end graph loops
    
    /*
    // start "countries visiting"
    
    $query="SELECT min(time) FROM user_track WHERE type<>'stats'";
    @$oldest=$gmt_offset+$bbdb->get_var($query);
    
    $query="SELECT count(*) as count,ut1.cc,cc2.country FROM <code>user_track</code> ut1 LEFT JOIN cc2country cc2 ON ut1.cc = cc2.cc WHERE ut1.type<>'stats' group by ut1.cc ORDER BY cc2.country ASC";
    @$results=$bbdb->get_results($query);
    
        $maxheight=190; $count=0; unset($values); unset($labels); unset($colors);
        foreach ($results as $result) {
        	if ($result->count>1) {			// just one visitor is a fluke
    		$values[$count]=$result->count;
        		$labels[$count]=" $result->country </td><td> <img title='$result->cc' class='ut_flag' src='/images/flags/".strtolower($result->cc).".png'>";
        		$count++;
        	}
        }
        $peak=$values; arsort($peak); $peak=array_keys($peak);
        $colors[$peak[0]]="#cc0000";
        $colors[$peak[1]]="#0000cc";
        $colors[$peak[2]]="#00cc00";
        $multiply=$maxheight/$values[$peak[2]];
        // $width=floor(100/($count+1)); if ($width<1) {$width=1;} elseif ($width>100) {$width=50;}
        $half=intval($count/2); $alt=0;
    
    $output= "<br clear='both'><h3 align='center'>$count Countries Visiting Since <span title='".gmdate("r",$oldest)."' class='ut_time'>".ucwords(ut_since($oldest))."</span></h3>";
    $output.= "<table class='mini_track_graph mini_track_graph2'>";    
    
    foreach (array_keys($values) as $count)  {
    	if ($count==$half) {$output.="</table><table class='mini_track_graph mini_track_graph2' style='float:right;'>"; $alt=0;}
    	$alt++; $output.="<tr".(($alt % 2) ? " class='alt'" : "").">";
    	$output.="<td>$labels[$count]</td>";
    	$height=$multiply*$values[$count]; if ($height>$maxheight) {$height=$maxheight;}
    	$output.="<td><span><div style='width:".$height."px;";
    	if (isset($colors[$count])) {$output.="background:$colors[$count];";}
    	$output.="'> </div> $values[$count]</span></td></tr>";
    }
    $output.= "</table><br clear='both'>";
    echo $output;
    */
    
    bb_get_footer();
    exit();
    }
    Posted 3 years ago #
  3. luckydost
    luckydost

    member
    Joined: Sep '08
    Posts: 17

    offline

    I have created own "mini-track" folder. when, i have done your new code in mini-track-admin.php following error occur.

    bbPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'time,data FROM mini_track WHERE time > 12' at line 1]
    SELECT time,data FROM mini_track WHERE time > 1222746497 ORDER BY time ASC LIMIT 31

    Warning: Invalid argument supplied for foreach() in /home/mobi11c/public_html/forum/bb-plugins/mini-track/mini-track-admin.php on line 335

    And Flags[/b] not display. all file uploaded at suitable place.

    footer.php>> Coding
    <div id="footer">
    <?php mini_track(1); // who's online now ?>
    <?php mini_track_today(1); // who's been online today ?>
    <?php mini_track_statistics(2); // general statistics ?>
    <p><?php printf(__('%1$s is proudly powered by bbPress.'), bb_option('name'), "http://bbpress.org") ?></p>
    [b]

    Posted 3 years ago #
  4. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    There may be a bug with the data.
    Something is out of sync.
    Did you try using the [reset] in the upper right of the mini-track-display?

    Posted 3 years ago #
  5. luckydost
    luckydost

    member
    Joined: Sep '08
    Posts: 17

    offline

    Thanks, I have fixed the bug....!
    What About Flags??? Please Suggest Me Friend...!
    Waiting..

    Posted 3 years ago #
  6. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    Flags requires the appropriate files in place and these two settings:

    $mini_track_options['geoip'] = "ip2c";
    $mini_track_options['flags'] = "/images/flags/";

    Note that /images/flags/ should be replaced with your URL path to the flags.

    Posted 3 years ago #
  7. luckydost
    luckydost

    member
    Joined: Sep '08
    Posts: 17

    offline

    OK,
    1) What coding, you are use in footar.php and for flags output???
    2) What function of "ip-to-country.bin" ??? All Server support this???

    Posted 3 years ago #
  8. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    The .bin file is simply a compressed database.
    You have to follow the directions and put it in the proper place.

    Posted 3 years ago #
  9. luckydost
    luckydost

    member
    Joined: Sep '08
    Posts: 17

    offline

    I have Updated Place...!

    $mini_track_options['flags'] = false; // "http://www.mobi11.com/forum/bb-plugins/mini-track/flags/";

    But not get, success's.

    Posted 3 years ago #
  10. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 884

    offline

    Sorry, in php two slashes means it's a comment.

    The line should look like:

    $mini_track_options['flags'] = "http://www.mobi11.com/forum/bb-plugins/mini-track/flags/";

    Posted 3 years ago #

RSS feed for this topic

Post a reply to “Mini Tracks Plugin Problem” »

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
23 users online from in the past 30 minutes. 12 bots 10 guests 1 members: mccawphoto
7,232 views today 8,665 yesterday 14,010 peak. Most at once 63 today 48 yesterday 131 peak. Visited today: Dickinsonjohn9, shairah27, xiaotian, _ck_, engin1984, Augustine01, MichaelGomez, mccawphoto
2,240 posts in 380 topics over 63 months by 425 of 1,992 members. Latest: shairah27, Augustine01, MichaelGomez