Skip to:
Content

bbPress.org

Ticket #3188: 3188.patch

File 3188.patch, 1.3 KB (added by SergeyBiryukov, 9 years ago)
  • src/includes/common/functions.php

     
    179179        // Default value
    180180        $retval = false;
    181181
     182        // Get number of minutes to allow editing for
     183        $minutes = (int) get_option( '_bbp_edit_lock', 5 );
     184
     185        // Now
     186        $cur_time = current_time( 'timestamp', true );
     187
     188        // Period of time
     189        $lockable  = "+{$minutes} minutes";
     190
     191        // Add lockable time to post time
     192        $lock_time = strtotime( $lockable, strtotime( $post_date_gmt ) );
     193
    182194        // Check if date and editing is allowed
    183195        if ( ! empty( $post_date_gmt ) && bbp_allow_content_edit() ) {
    184196
    185                 // Get number of minutes to allow editing for
    186                 $minutes = (int) get_option( '_bbp_edit_lock', 5 );
    187 
    188197                // "0" minutes set, so allow forever
    189198                if ( 0 === $minutes ) {
    190199                        $retval = true;
    191200
    192201                // Not "0" so compare
    193                 } else {
    194 
    195                         // Period of time
    196                         $lockable  = "+{$minutes} minutes";
    197 
    198                         // Now
    199                         $cur_time  = current_time( 'timestamp', true );
    200 
    201                         // Add lockable time to post time
    202                         $lock_time = strtotime( $lockable, strtotime( $post_date_gmt ) );
    203 
    204                         // Compare
    205                         if ( $cur_time >= $lock_time ) {
    206                                 $retval = true;
    207                         }
     202                } elseif ( $cur_time >= $lock_time ) {
     203                        $retval = true;
    208204                }
    209205        }
    210206