Recent Topics

1 Jun 12, 2008 08:22    

My b2evolution Version: Not Entered

Hello,

we are considering using b2evolution for some corporate intranet news blogging, however for this we would like to only show posts that appeared within the last x days (some blogs will be relatively low traffic). Under Backoffice - Blogs - Blogname I have set the option under Content/posts to 10 days per page as display unit.

If I make a few posts, the old ones nicely dissapear from the page after they are older than 10 days. However, once only 1-2 or so posts are left, they do not got removed and stay indefinitly, even if they are 30+ days old.

We would like it so that it says "No posts found" or something, if no posts are less than x days old.

Also, if said last few posts remain, and I hide them manually, suddenly even older posts (which had previously dissapeared automatically) reappear. So it seems it always wants to display something.

Any hints on how we could achieve this or what might be the problem. We can manually hack php if required (but we prefer not to of course).

Thank you very much for you're help.

2 Jun 12, 2008 08:39

Welcome to the forums.

You can set $timestamp_min in blog's stub file and I think this is exactly what you need.

Try the following, I don't know if it actually works ;)

$timestamp_min = mktime( 0, 0, 0, date("m"), date("d")-10, date("Y") );

3 Jun 12, 2008 08:41

Crack open your /index.php and meander down to the bottom where you'll find a section of code like this :

# Here you can set a limit before which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the past
$timestamp_min = '';

Set that to time() - #days * 24 * 60 * 60 ;)

¥

*edit*
Damn, guess I need to open files faster :p

4 Jun 12, 2008 09:08

Hi,

Thank you both for the prompt reply.

If I understand correctly, this will completely ignore all posts older than timestamp_min, even when searching, or browsing by category (we would like to retain this possibility, only when calling the page by default should nothing appear)? Trying to understand what I'm modifying also ;-)

5 Jun 12, 2008 09:23

Ok, that'd be a smidge tougher to achieve. This may or may not work

if( empty( $_GET ) || ( sizeof( $_GET ) == 1 && isset( $_GET['blog'] ) ) )
{
  $timestamp_min = nn; // change nn as pre previous posts
}

¥

6 Jun 12, 2008 16:53

Thnx for the tipp, we didn't get around to trying it yet, but I will make sure to report back if we suceeded or failed :-)


Form is loading...