Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/21/2010 07:33:39 PM (16 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2203 and #2497. Introduces bp_core_current_time function as central handler for all time related functions. Removes unused bp_core_format_time in lieu of currently used bp_format_time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-templatetags.php

    r3111 r3142  
    841841
    842842function bp_format_time( $time, $just_date = false ) {
    843         $date = date( get_option('date_format'), $time );
    844 
    845         if ( !$just_date ) {
    846                 $date .= ' ' . __( 'at', 'buddypress' ) . date( ' ' . get_option('time_format'), $time );
    847         }
     843        if ( !$time )
     844                return false;
     845
     846        // Get GMT offset from root blog
     847        $root_blog_offset = get_blog_option( BP_ROOT_BLOG, 'gmt_offset' );
     848
     849        // Calculate offset time
     850        $time_offest = $time + ( $root_blog_offset * 3600 );
     851
     852        // Current date (January 1, 2010)
     853        $date = date( 'F j, Y ', $time_offest );
     854
     855        // Current time (9:50pm)
     856        $time = date( ' g:ia', $time_offest );
     857
     858        // Should we show the time also?
     859        if ( !$just_date )
     860                $date .= __( 'at', 'buddypress' ) . date( ' g:iA', $time_offest );
    848861
    849862        return apply_filters( 'bp_format_time', $date );
Note: See TracChangeset for help on using the changeset viewer.