Skip to:
Content
Pages
Categories
Search
Top
Bottom

-1 years problem with topic_time (bbPress 1.0.2)


  • Rose
    Member

    @thorned-rose

    I’m creating a website with WordPress and bbPress that needs a section where someone can fill out an application form (from a WordPress page) and that will create a new topic in bbPress with the info they filled in.

    We decided that the easiest way would be to have the form data submitted straight into the bbPress database.

    I experimented with phpmyadmin by adding new records with the correct info in bbposts, increased the post counts in bbtopics and finally used the post time I’d set in bbposts (post_time) with topic_time to update the ‘freshness’. I used phpmyadmin’s default date/time selector to replicate the records’ formatting correctly.

    While the new post showed up perfectly and the post counts were correct, the freshness came up as being “-1 years”

    I changed the code in front-page.php to the following as outlined by _ck_ :

    <td class="num">" title="<?php echo date("r",strtotime($topic->topic_time)); ?>"><?php topic_time(); ?></td>

    so that I could see what it was coming up with as the posted date and time. The results were… ‘interesting’ –

    On mousing over the -1 years, I got the correct date and time.

    On mousing over the correct freshness times of other posts I had made the same day, I got a date and time that seems to be 12 hours behind.

    Here are the links to images outlining this:

    -1 years freshness but correct date/time image

    ‘Normal’ freshness time but with wrong date/time image

    Can someone please explain what is going wrong and if possible how to fix it or get around this problem with adding topics directly to the database. I’m starting to /facedesk so help would be much appreciated!! :)

Viewing 1 replies (of 1 total)

  • _ck_
    Participant

    @_ck_

    You’ll get incorrect dates when the bbpress api cannot see the correct time.

    But if you are saying the mouseover is working, that means that $topic has the right time.

    I suspect you do not have $topic as a global before your loop.

    So find the foreach you have and put global $topic; before it.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar