Skip to:
Content
Pages
Categories
Search
Top
Bottom

Freshness date


  • 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)

  • guru06
    Participant

    @guru06

    Anyone?


    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.


    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

    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.


    guru06
    Participant

    @guru06

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


    r-a-y
    Keymaster

    @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.


    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.


    r-a-y
    Keymaster

    @r-a-y

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


    guru06
    Participant

    @guru06

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


    Roger Coathup
    Participant

    @rogercoathup

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


    guru06
    Participant

    @guru06

    thats over my head, can you explain a little more


    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)
  • The topic ‘Freshness date’ is closed to new replies.
Skip to toolbar