Skip to:
Content
Pages
Categories
Search
Top
Bottom

Echoing "Submitted on" date


  • oqm4
    Participant

    @oqm4

    I’d like to echo a forum post’s “Submitted on” date, thereby allowing admins to customize post dates and times. Specifically, I’m referring to the timestamp one edits in the WP admin back-end (“Activity” > “Edit” > “Submitted on: … “) and that WP stores as an “activity_update” in the “date_recorded” column of the “bp_activity” table.

    I’m able to echo the post time with this string:

    date("m/j/y", strtotime($topic_template->post->post_time))

    … but I can’t seem to echo the date recorded. When I adjust the above string as follows:

    date("m/j/y", strtotime($activity_template->activity->date_recorded))

    … BP/WP outputs 01/1/70 vs. the correct “date recorded.”

    I’m running WP 3.5 and BP 1.6.1.

    Thanks in advance for whatever suggestions can be provided.

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

  • oqm4
    Participant

    @oqm4

    Bump.

    Debug those variables. 1/1/70 is the unix epoch, which suggests to me that $activity_template->activity->date_recorded is not set or empty.


    oqm4
    Participant

    @oqm4

    Thanks for the suggestion, Paul. It helps frame the issue, I think.

    Curiously enough, I’ve verified that the “activity_update” in the “date_recorded” column of the “bp_activity” table contains data. This leads me to believe I’m not using the proper variables. I could be wrong, of course, but I’m certain the relevant data exists in the database. I’m just having trouble outputting it on the front-end.


    oqm4
    Participant

    @oqm4

    Bump. Bump.


    danbpfr
    Participant

    @chouf1

    hi,

    take a look in bp-activity-admin.php:1295


    danbpfr
    Participant

    @chouf1

    sorry, for the frontend you can look in bp-default/index.php:34


    oqm4
    Participant

    @oqm4

    Thanks so much for your suggestion, Chouf1, but, as far as I can tell, I’m afraid neither of those code blocks …

    `printf( __( ‘Submitted on %2$s at %3$s‘, ‘buddypress’ ), bp_get_root_domain() . ‘/’ . bp_get_activity_root_slug() . ‘/p/’ . $item[‘id’] . ‘/’, date_i18n( get_option( ‘date_format’ ), strtotime( $item[‘date_recorded’] ) ), date_i18n( get_option( ‘time_format’ ), strtotime( $item[‘date_recorded’] ) ) );`

    or

    `<?php printf( __( '%1$s in %2$s’, ‘buddypress’ ), get_the_date(), get_the_category_list( ‘, ‘ ) ); ?>`

    .. yielded anything I can use.

    `get_the_date()` echoes the logged in user’s most recent activity (I think), and this modified string, based on the top block, outputs the UNIX epoch:

    `date(“m/j/y”, strtotime($item->date_recorded))`


    oqm4
    Participant

    @oqm4

    Bump. Bump. Bump.


    danbpfr
    Participant

    @chouf1

    Perhaps ` bp_the_topic_time` ?

    in bp-forums-template.php:622


    oqm4
    Participant

    @oqm4

    I’m afraid `bp_get_the_topic_time` echos the same information as `date(“m/j/y”, strtotime($topic_template->post->post_time))`


    oqm4
    Participant

    @oqm4

    Bump. Bump. Bump. Bump.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Echoing "Submitted on" date’ is closed to new replies.
Skip to toolbar