Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display Private Message Time rather than Time Since Sent


  • KS Web Designer
    Participant

    @ks-webdesignercom

    I’m sure the answer to this is fairly simple, just can’t seem to find anyone who knows it…

    In the messages/single.php template there is this code:
    <span class="activity"><?php bp_the_thread_message_time_since(); ?></span>

    This calculates the time since a private message was sent and displays it something like this: “Sent 5 minutes ago”.

    Is there any way to display just the time it was sent? I know you can display the time the last private message in a conversation was sent, but I’d like to show the time for each individual message.

    Thanks

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

  • Henry
    Member

    @henrywright-1

    I think you might be able to do something like this in functions.php

    
    function absolute_message_sent_date() {
        global $thread_template;
        return $thread_template->message->date_sent
    }
    

    Then this will go straight into your single.php template

    echo absolute_message_sent_date();


    KS Web Designer
    Participant

    @ks-webdesignercom

    Perfect, that did the trick. For anyone else following this be sure to add the semi-colon after return $thread_template->message->date_sent so the snippet reads:

    function absolute_message_sent_date() {
        global $thread_template;
        return $thread_template->message->date_sent;
    }

    Just one quick follow-up question. How do I change the date format? Where do I specify how the date should appear?

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Private Message Time rather than Time Since Sent’ is closed to new replies.
Skip to toolbar