Hallo, Gast! (Registrieren)

Wir wünschen allen Besuchern frohe Ostern!

Letzte Ankündigung: MyBB 1.8.37 veröffentlicht (04.11.23)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Forum aus den statistiken ausschließen
#1
Ich würde gerne das forum mit der id 26 aus den statistiken ausnehmen - das hab ich bei 1.4 schonmal gemacht, funzt hier aber nur zur hälfte:

PHP-Code:
<?php
/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id: stats.php 5016 2010-06-12 00:24:02Z RyanGordon $
 */

define("IN_MYBB"1);
define('THIS_SCRIPT''stats.php');

$templatelist "stats,stats_thread";
require_once 
"./global.php";
require_once 
MYBB_ROOT."inc/functions_post.php";
require_once 
MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

// Load global language phrases
$lang->load("stats");

add_breadcrumb($lang->nav_stats);

$stats $cache->read("stats");

if(
$stats['numthreads'] < || $stats['numusers'] < 1)
{
    
error($lang->not_enough_info_stats);
}

$plugins->run_hooks("stats_start");

$repliesperthread my_number_format(round((($stats['numposts'] - $stats['numthreads']) / $stats['numthreads']), 2));
$postspermember my_number_format(round(($stats['numposts'] / $stats['numusers']), 2));

// Get number of days since board start (might need improvement)
$query $db->simple_select("users""regdate""", array('order_by' => 'regdate''limit' => 1));
$result $db->fetch_array($query);
$days = (TIME_NOW $result['regdate']) / 86400;
if(
$days 1)
{
    
$days 1;
}
// Get "per day" things
$postsperday my_number_format(round(($stats['numposts'] / $days), 2));
$threadsperday my_number_format(round(($stats['numthreads'] / $days), 2));
$membersperday my_number_format(round(($stats['numusers'] / $days), 2));

// Get forum permissions
$unviewableforums get_unviewable_forums(true);

// edit by MH

if(empty($unviewableforums)) {
    
$unviewableforums "26";
} else {
    
$unviewableforums .= ",26";


//end of edit

$fidnot '1=1';
$unviewableforumsarray = array();
if(
$unviewableforums)
{
    
$fidnot "fid NOT IN ($unviewableforums)";
    
$unviewableforumsarray explode(','$unviewableforums);
}

// Most replied-to threads



$most_replied $cache->read("most_replied_threads");

if(!
$most_replied)
{
    
$cache->update_most_replied_threads();
    
$most_replied $cache->read("most_replied_threads"true);
}

if(!empty(
$most_replied))
{
    foreach(
$most_replied as $key => $thread)
    {
        if(!
in_array("'{$thread['fid']}'"$unviewableforumsarray))
        {
            
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
            
$numberbit my_number_format($thread['replies']);
            
$numbertype $lang->replies;
            
$thread['threadlink'] = get_thread_link($thread['tid']);
            eval(
"\$mostreplies .= \"".$templates->get("stats_thread")."\";");
        }
    }
}

// Most viewed threads
$most_viewed $cache->read("most_viewed_threads");

if(!
$most_viewed)
{
    
$cache->update_most_viewed_threads();
    
$most_viewed $cache->read("most_viewed_threads"true);
}

if(!empty(
$most_viewed))
{
    foreach(
$most_viewed as $key => $thread)
    {
        if(!
in_array("'{$thread['fid']}'"$unviewableforumsarray))
        {
            
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
            
$numberbit my_number_format($thread['views']);
            
$numbertype $lang->views;
            
$thread['threadlink'] = get_thread_link($thread['tid']);
            eval(
"\$mostviews .= \"".$templates->get("stats_thread")."\";");
        }
    }
}

// Top forum
if(!empty($fidnot))
{
    
$fidnot .= " AND";
}
$query $db->simple_select("forums""fid, name, threads, posts""$fidnot type='f'", array('order_by' => 'posts''order_dir' => 'DESC''limit' => 1));
$forum $db->fetch_array($query);
if(!
$forum['posts'])
{
    
$topforum $lang->none;
    
$topforumposts $lang->no;
    
$topforumthreads $lang->no;
}
else
{
    
$topforum "<a href=\"".get_forum_link($forum['fid'])."\">{$forum['name']}</a>";
    
$topforumposts $forum['posts'];
    
$topforumthreads $forum['threads'];
}

// Today's top poster
$timesearch TIME_NOW 86400;
switch(
$db->type)
{
    case 
"pgsql":
        
$query $db->query("
            SELECT u.uid, u.username, COUNT(*) AS poststoday
            FROM "
.TABLE_PREFIX."posts p
            LEFT JOIN "
.TABLE_PREFIX."users u ON (p.uid=u.uid)
            WHERE p.dateline > 
$timesearch
            GROUP BY "
.$db->build_fields_string("users""u.")." ORDER BY poststoday DESC
            LIMIT 1
        "
);
        break;
    default:
        
$query $db->query("
            SELECT u.uid, u.username, COUNT(*) AS poststoday
            FROM "
.TABLE_PREFIX."posts p
            LEFT JOIN "
.TABLE_PREFIX."users u ON (p.uid=u.uid)
            WHERE p.dateline > 
$timesearch
            GROUP BY p.uid ORDER BY poststoday DESC
            LIMIT 1
        "
);
}
$user $db->fetch_array($query);
if(!
$user['poststoday'])
{
    
$topposter $lang->nobody;
    
$topposterposts $lang->no_posts;
}
else
{
    if(!
$user['uid'])
    {
        
$topposter $lang->guest;
    }
    else
    {
        
$topposter build_profile_link($user['username'], $user['uid']);
    }
    
$topposterposts $user['poststoday'];
}

// What percent of members have posted?
$query $db->simple_select("users""COUNT(*) AS count""postnum > 0");
$posters $db->fetch_field($query"count");
$havepostedpercent my_number_format(round((($posters $stats['numusers']) * 100), 2)) . "%";

$lang->todays_top_poster $lang->sprintf($lang->todays_top_poster$toppostermy_number_format($topposterposts));
$lang->popular_forum $lang->sprintf($lang->popular_forum$topforummy_number_format($topforumposts), my_number_format($topforumthreads));

$stats['numposts'] = my_number_format($stats['numposts']);
$stats['numthreads'] = my_number_format($stats['numthreads']);
$stats['numusers'] = my_number_format($stats['numusers']);
$stats['newest_user'] = build_profile_link($stats['lastusername'], $stats['lastuid']);

$plugins->run_hooks("stats_end");

eval(
"\$stats = \"".$templates->get("stats")."\";");
output_page($stats);
?>

Für den Most-Popular Teil führt das was ich bisher drin hab :;

PHP-Code:
// Most replied-to threads

// edit by MH

$unviewableforumsarray[] = "'26'";

// end of edit

$most_replied $cache->read("most_replied_threads"); 

Dazu dass weniger Threads (in meinem fall gar keine da alle populärsten thread im forum 26 sind) angezeigt werden, wie muss ich das anpassen?
Zitieren
#2
Was funktioniert denn mit der alten Änderung nicht?
[Bild: banner.png]

Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Zitieren
#3
wie schon gesaagt - anstelle threads au anderen foren erscheinen weniger threads (also 10 abzüglich der threads aus dem gesperrten forum)
Zitieren
#4
Das ist logisch. Die Statistiken werden aus einem Cache gelesen, welcher nur eine bestimmte Anzahl an Datensätzen enthält. Aus diesen filterst du dann noch welche raus. Die bessere Methoder wäre der Ausschluss des Forums bei der Generierung der Caches (in/class_datacache.php; Funktionen: update_most_replied_threads() & update_most_viewed_threads()).

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren
#5
naja, php kann ich leider nicht - ich hab nur den code gepostet den ich bisher verwendet hab...
Zitieren
#6
Suche in beiden Funktionen nach
Code:
"visible='1'"
Ersetzen durch:
Code:
"visible='1' AND fid !='26'"

Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Zitieren
#7
Folgende Änderung:
PHP-Code:
        else
        {
            
// Normal users
            
$p_unapproved_where visible='1' AND fid !='26';
            
$t_unapproved_where 'visible < 1';
        } 


Da kam folgende Fehlermeldung:

Parse error: syntax error, unexpected '=' in /var/www/web742/html/lfe/forum/search.php on line 660
Zitieren
#8
PHP-Code:
        else
        {
            
// Normal users
            
$p_unapproved_where "visible='1' AND fid !='26'";
            
$t_unapproved_where 'visible < 1';
        } 
[Bild: banner.png]

Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Wie im AJAX-Chat bestimmte Benutzgruppen ausschließen? Koelner 14 4.513 20.03.2015, 08:16
Letzter Beitrag: Koelner
  Ajax-Chat - Gäste ausschließen. Koelner 30 10.879 21.09.2014, 00:46
Letzter Beitrag: Dana
  Einzelnen Benutzer aus "Neuen Beiträgen" ausschließen packz 12 3.229 13.07.2012, 23:39
Letzter Beitrag: Jockl
  Url's ausschließen? Gökhan 14 3.074 18.02.2012, 18:29
Letzter Beitrag: Gökhan
  Foren aus der Overview ausschließen Boolean 7 3.027 20.02.2010, 15:46
Letzter Beitrag: StefanT