Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#543 closed defect (bug) (fixed)

New Post not added to activity (site wide or user)

Reported by: westpointer Owned by:
Priority: major Milestone:
Component: Version:
Severity: Keywords:
Cc:

Description

When a new post is published, site wide activity and user activity are not updated.

I've tracked this down to bp-blogs.php, line 443

if ( $recorded_post->date_created >= strtotime( "-30 minutes" ) ) {

I tested changing the time to -3000 and the post was added to the activity tables. I think the problem is that $recorded_post->date_created is based on my time zone, EST. But strtotime( "-30 minutes" ) is using mountain time (the wpmu default time zone). Therefor, my new post always evaluates as being more than 30 minutes old.

Change History (5)

No, not mountain time, it must be evaluating using GMT.

OK, this is a confirmed bug. The post_date reflects the time zone set for the blog which is mountain time. I'm in the eastern time zone so my post was seen by this line of code as 2 hours old as soon as I added the post. We need to off-set for the time zone.

REPLACE:

if ( $recorded_post->date_created >= strtotime( "-30 minutes" ) )

WITH

'
if ( $recorded_post->date_created >= (current_time('timestamp') - 30) )

that will fix the problem!

Your code would subtract 30 seconds.

There is actually a global problem with time zone calculations. I'm going to change this to 24 hours, which will patch it for now. Time zones need to be addressed on a broader scale.

  • Resolution set to fixed
  • Status changed from new to closed

(In [1186]) Fixes #543

LOL .. sorry, yes that would be 30 seconds! But, I found that the change does do the job.

Note: See TracTickets for help on using tickets.