Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • @casix

    Member

    Nice site looking good keep up the good work.

    FYI need to fix your menu community on top. Groups(Clans) and Forums don’t point to there pages.

    @casix

    Member

    Never mind I figured it out. I modified the code bp_get_group_date_created() so it does get the date. For those who want to do the same or if the group for buddypress want to modify the code to do it the same, here is what I did.

    I didn’t want to do lot of code change that way if BP does any updates it would be easy to put the mod back in.

    Note: This mod requires you to modifying the BP core make a back up each file before modifying.

    1st I created a new function in the bp_core_function.php called bp_core_date_since() and I put it above bp_core_time_since() to keep them together.



    function bp_core_date_since($older_date) {

    // array of time period chunks
    $chunks = array(
    array( 60 * 60 * 24 * 365 , __( 'year', 'buddypress' ), __( 'years', 'buddypress' ) ),
    array( 60 * 60 * 24 * 30 , __( 'month', 'buddypress' ), __( 'months', 'buddypress' ) ),
    array( 60 * 60 * 24 * 7, __( 'week', 'buddypress' ), __( 'weeks', 'buddypress' ) ),
    array( 60 * 60 * 24 , __( 'day', 'buddypress' ), __( 'days', 'buddypress' ) ),
    array( 60 * 60 , __( 'hour', 'buddypress' ), __( 'hours', 'buddypress' ) ),
    array( 60 , __( 'minute', 'buddypress' ), __( 'minutes', 'buddypress' ) ),
    array( 1, __( 'second', 'buddypress' ), __( 'seconds', 'buddypress' ) )
    );

    if ( !empty( $older_date ) && !is_numeric( $older_date ) ) {
    $time_chunks = explode( ':', str_replace( ' ', ':', $older_date ) );
    $date_chunks = explode( '-', str_replace( ' ', '-', $older_date ) );
    $older_date = gmmktime( (int)$time_chunks[1], (int)$time_chunks[2], (int)$time_chunks[3], (int)$date_chunks[1], (int)$date_chunks[2], (int)$date_chunks[0] );

    }
    $output = date("F d, Y",$older_date);

    return $output;
    }

    Next I modify the function bp_group_date_created() in the bp_groups_template.php

    rem out the return and created a new return



    return apply_filters( 'bp_get_group_date_created', bp_core_date_since(strtotime($group->date_created)) );

    Now anytime you want to show date created in stead of time since you just replace bp_groups_last_active() to bp_groups_date_created().

    So now instead of showing “active since 1 day, 20 hours”. It shows “Created September 8, 2011”

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar