1. Home
  2. Knowledge Base
  3. Customizations
  4. PHP Functions
  5. How to Fix the Time Format on BuddyBoss Messages

How to Fix the Time Format on BuddyBoss Messages

Introduction

The message timestamps in BuddyBoss may not follow the time format set in your WordPress settings. You can fix this by adding a custom function to your active theme. This guide explains how you can fix the time format on BuddyBoss messages.

Note: BuddyBoss does not provide a built-in setting for this. The steps below are a custom workaround.

Custom Workaround

Before proceeding, make sure you have a complete site backup.

  1. In your WordPress admin dashboard, go to Appearance > Theme Editor.
  2. Under Select theme to edit, choose your active theme (preferably BuddyBoss Child Theme), then click Select.
  3. From the Theme Files list, click Theme Functions (functions.php).
  4. Paste the following code just before the closing PHP tag (?>):
function bb_change_time_format_to_wp_time( $site_sent_date ) {

    if ( function_exists( 'bp_get_the_thread_message_date_sent' ) ) {

        $sent_date = bp_get_the_thread_message_date_sent();

        $sent_date_formatted = wp_date( 'Y-m-d h:i:s', $sent_date );

        $site_sent_date = get_date_from_gmt( $sent_date_formatted );

        $time_format = get_option( 'time_format' );

        $time_format = ! empty( $time_format ) ? $time_format : 'g:i a';

        $site_sent_date = wp_date( $time_format, strtotime( $site_sent_date ) );

    }

    return $site_sent_date;

}

add_filter( ‘bb_get_the_thread_message_sent_time’, ‘bb_change_time_format_to_wp_time’, 99, 1 );

  1. Click Update File to save your changes.

Note: Any modifications like this are considered custom work. Please review the BuddyBoss Support Policy for details.

Troubleshooting and FAQs

Q: The message time is still incorrect, what should I check?
A: Make sure the code is added to the active theme’s functions.php and clear any caches.

Q: Can I change the time format?
A: Yes, update the WordPress Time Format under Settings > General, or modify the $time_format value in the code.

Q: Will this affect other areas of the site?
A: No, this change only affects message timestamps.

Q: Can I revert this change easily?
A: Yes, remove the code from functions.php and save.

Q: Who can I contact for further assistance?
A: Check the BuddyBoss Support Policy or consult a developer.

Was this article helpful?

Related Articles

Subscribe to Our Newsletter

Stay In Touch

Subscribe to our Newsletter, and we’ll send you the latest news from BuddyBoss

  • This field is hidden when viewing the form
  • This field is for validation purposes and should be left unchanged.

To speak to our Agency consultant, fill in the form found at our Contact Page.

  • Get Started

    Enter your name and email address to get started with your project...

  • This field is for validation purposes and should be left unchanged.