Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

how to show number of new posts and new threads per day in Index_boardstat Template ?

Ads
banner
banner
banner
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#1
Member
Hello
I want to show number of new posts and new threads per day in Index_boardstat Template
could you help me ?

Heart
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#2
Support Team
Hi you'll need a plugin? Why don't you test this one: "MyBB - Mods - Recent Posts Forum Index" change compatibility from 1.4 to 1.6 if needed.

You only need a number of post and number of thread within the last 24h right? I will take a look at this later feel really slippy and tired Wink
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#3
Member
Thanks Marcus for your attention
Yes, I need a number of post and number of thread within the last 24h
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#4
Support Team
Hy buddy this is what I have come up with. I have created a simple plugin that will display this message in Board Statistics
Our users have made X posts, X threads in the last 24 hours.

I am not rally good at creating plugins that will automatically modify template so you are gonna have to do it manually, in fact I prefer this method cause this way I can easily keep track of all template modifications.

Open index_stats template and add this code after {$lang->stats_mostonline}

Code:
<br />
<div>Our users have made <strong>{$todaysposts}</strong> posts, <strong>{$todaysthreads}</strong> threads in the last 24 hours.</div>
</span>

Now save this code as poststhreadscount.php and upload it to inc/plugins directory.

PHP Code:
<?php

if(!defined("IN_MYBB"))
{
    die(
"This file cannot be accessed directly.");
}

$plugins->add_hook('index_start''poststhreadscount');

function 
poststhreadscount_info()
{
    return array(
        
"name"            =>    "Posts and threads counter",
        
"description"    =>    "Shows number of posts and threads posted within 24 hours.",
        
"website"        =>    "http://letsofrum.com",
        
"author"        =>    "Victor Dub",
        
"version"        =>    "1.0",
        
"compatibility" =>    "16*",
    );
}


function 
poststhreadscount()
{
    global 
$db$mybb$todaysposts$todaysthreads;
    
    
$datecut TIME_NOW - (86400);
    
    
$query1 $db->simple_select('threads''COUNT(tid) AS count1''dateline >= '.$datecut);
    
$threads_today $db->fetch_field($query1"count1");
    
$query2 $db->simple_select('posts''COUNT(pid) AS count2''dateline >= '.$datecut);
$posts_today $db->fetch_field($query2"count2");

    
    if(
$threads_today)
    {
    
$todaysthreads .= "<span>{$threads_today}</span>";
    }
    else
    {
        
$todaysthreads .= "<span>0</span>";
    }
    
    if(
$posts_today)
    {
        
$todaysposts .= "<span>{$posts_today}</span>";
    }
    else
    {
        
$todaysposts .= "<span>0</span>";
    }
}
?>

Don't forget to activate Smile
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#5
Member
Wow !
I can't say anything , you're great

Best Regards
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#6
Member
Hello
I used this plugin, but TIME_NOW doesn't work
victor Offline referral

Posts: 638
Joined: Jun 2013
Reputation: 33

#7
Senior Member
Try $datecut = TIME_NOW - 86400;
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#8
Support Team
(07-12-2014 09:40 AM)lion Wrote:  Hello
I used this plugin, but TIME_NOW doesn't work

What do you mean by that? It works on my forum. Please tell me what do you want to do? Are you trying to modify dateline?
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#9
Member
(07-12-2014 01:32 PM)victor Wrote:  Try $datecut = TIME_NOW - 86400;

Thanks Victor, I replaced it.
Solved
Heart
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#10
Support Team
@lion in here "TIME_NOW - 86400" means 24 hours in seconds. So if you want to change this value then simply convert hours into seconds.





User(s) browsing this thread: 1 Guest(s)