MyBB.de Forum
Thread Views nur bei reg. Usern hochzählen - Druckversion

+- MyBB.de Forum (https://www.mybb.de/forum)
+-- Forum: MyBB 1.8.x (https://www.mybb.de/forum/forum-87.html)
+--- Forum: Allgemeiner Support (https://www.mybb.de/forum/forum-88.html)
+--- Thema: Thread Views nur bei reg. Usern hochzählen (/thread-36205.html)



Thread Views nur bei reg. Usern hochzählen - KH1990 - 24.01.2019

Hallo mybb.de!

Ich habe vor Kurzem ein myBB 1.8.19 Forum aufgesetzt und ich benutze das Flatty Theme.

Momentan kann man meine Threads auch lesen wenn man nicht registriert ist. Das soll auch so bleiben. Jedoch möchte ich, dass Views von unregistrierten Gästen nicht mitgezählt werden. Es sollen nur die Views von registrierten Gästen gezählt werden.

Jemand ne Idee wie ich das hinbekomme?

Danke.


RE: Thread Views nur bei reg. Usern hochzählen - doylecc - 24.01.2019

Hallo,

dafür suche mal in der Datei showthread.php nach diesem Code:
PHP-Code:
// Increment the thread view.
if($mybb->settings['delayedthreadviews'] == 1)
{
   $db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
}
else
{
   $db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}
++
$thread['views']; 

und ergänze ihn zu:
PHP-Code:
// Increment the thread view.
if($mybb->user['uid'])
{
   if($mybb->settings['delayedthreadviews'] == 1)
   {
       $db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
   }
   else
   
{
       $db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
   }
   ++$thread['views'];




RE: Thread Views nur bei reg. Usern hochzählen - KH1990 - 28.01.2019

(24.01.2019, 15:53)doylecc schrieb: Hallo,

dafür suche mal in der Datei showthread.php nach diesem Code:
PHP-Code:
// Increment the thread view.
if($mybb->settings['delayedthreadviews'] == 1)
{
   $db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
}
else
{
   $db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}
++
$thread['views']; 

und ergänze ihn zu:
PHP-Code:
// Increment the thread view.
if($mybb->user['uid'])
{
   if($mybb->settings['delayedthreadviews'] == 1)
   {
       $db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");
   }
   else
   
{
       $db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
   }
   ++$thread['views'];


Sieht gut aus. Wo finde ich denn die showthread.php? Sorry, bin noch Anfänger.


RE: Thread Views nur bei reg. Usern hochzählen - doylecc - 28.01.2019

Die befindet sich im Hauptordner des Forums, also dort, wohin du alle MyBB Dateien und Ordner per FTP hochgeladen hast.


RE: Thread Views nur bei reg. Usern hochzählen - KH1990 - 28.01.2019

(28.01.2019, 16:30)doylecc schrieb: Die befindet sich im Hauptordner des Forums, also dort, wohin du alle MyBB Dateien und Ordner per FTP hochgeladen hast.

Funktioniert jetzt. Danke!