Skip to:
Content
Pages
Categories
Search
Top
Bottom

Freshness date

  • Avatar of Guru06
    Guru06
    Participant

    @guru06

    I have been trying to change the Freshness from “hours since” last post to an “actual date”. After lots of trial and error I came up with this: “ which does exactly what I want except I cant change the format. It comes out 2010-09-03 15:34:15, I have tried the D M j Y G:i:s but that doesn’t change anything. Any suggestions?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Avatar of Guru06
    Guru06
    Participant

    @guru06

    Anyone?

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    have you tried using something like: date(“D M j Y G:i:s”, strtotime(bp_get_the_topic_time())) ?

    Converting the string to a timestamp and then reformatting it.

    Avatar of Guru06
    Guru06
    Participant

    @guru06

    Hi thanks for your reply, I did it like this:

    and ended up with:
    Parse error: syntax error, unexpected T_STRING in /home/*removed*/public_html/wp-content/plugins/buddypress/bp-themes/bp-default/forums/forums-loop.php on line 66

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Then you have an unexpected T_STRING on that line somewhere :)

    It basically means that your syntax is incorrect and you have terminated the line prematurely somewhere with a ‘ or , or ; or not closed the previous line.

    Avatar of Guru06
    Guru06
    Participant

    @guru06

    Changing this: “ to this “ did not work. Any suggestions

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Make sure you’re not using quotations in the date() function.

    Try this:
    `date(‘D M j Y G:i:s’, strtotime(bp_get_the_topic_time()));`

    I replied to a similar thread a while ago; I’ll try to dig it up.

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    I don’t think there should be any trouble with quotes in this case. See examples on this page, partic. #4 http://php.net/manual/en/function.date.php

    Are you still getting the ‘unexpected T_STRING’ message? Are you certain line 66 is your date(…) line?

    If Ray’s suggestion / similar thread doesn’t help, it would be a good idea to post a few more lines of your code, so we can see the snippet in context.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    There’s a problem with curling quotations (`“`) not (“) because it will give that T_STRING error.

    Avatar of Guru06
    Guru06
    Participant

    @guru06

    I just tried ` ` again with the proper quotes and now the date disappeared all together. I’m perplexed

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    You will need to echo the string returned from the function!

    Avatar of Guru06
    Guru06
    Participant

    @guru06

    thats over my head, can you explain a little more

    Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    date() returns a string, it doesn’t display it. You’ll need to use the ‘echo’ statement to display it.

    That’s a basic PHP question, not anything BuddyPress specific – Google “php echo”

    To work with the templates and significantly modify BuddyPress look and feel, a basic grounding in PHP is a pre-requisite.

Viewing 12 replies - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.