Search code examples
phpwordpressdatebuddypress

BuddyPress Group creation date


I want to display the creation date of a group with the date format j. F Y

For that, I tried the function bp_group_date_created(). Unfortunately I get the wrong format (10 days ago). The function also didn't accept any other format.

Does anyone have an idea?


Solution

  • I found a soultion:

    Copied the original function in the functions.php and changed it like this:

    function bp_get_group_date_created_ch( $group = false ) {
        global $groups_template;
    
        if ( empty( $group ) )
            $group =& $groups_template->group;
    
        return apply_filters( 'bp_get_group_date_created', strtotime( $group->date_created ) );
    }
    

    In the template I used this:

    <?php $timestamp=bp_get_group_date_created_ch(); echo gmdate("j.m.Y", $timestamp); ?>