Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/05/2020 08:59:46 PM (4 years ago)
Author:
johnjamesjacoby
Message:

Users: Correctly calculate offset in User Profile > Last Activity.

Previous to this, Last Activity was being saved with time() but then using the site offset on display. For negative timezones, this would cause "sometime ago" type output in screens like User Profiles.

Also correctly update Last Activity when posting new Topics and Replies, and add expiration to transients for anonymous users to prevent them from being autoloaded while also never expiring.

In trunk, for 2.7.0.

Fixes #3378.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/functions.php

    r7098 r7105  
    820820        // Set transient for throttle check (only on new, not edit)
    821821        if ( empty( $is_edit ) ) {
    822             set_transient( '_bbp_' . bbp_current_author_ip() . '_last_posted', time() );
    823         }
    824 
    825     // If not anonymous, then
    826     } else {
    827         if ( empty( $is_edit ) && ! current_user_can( 'throttle' ) ) {
    828             bbp_update_user_last_posted( $author_id );
     822            set_transient( '_bbp_' . bbp_current_author_ip() . '_last_posted', time(), HOUR_IN_SECONDS );
    829823        }
    830824    }
     
    859853    if ( empty( $is_edit ) ) {
    860854
    861         // Update poster IP if not editing
     855        // Update poster activity time
     856        bbp_update_user_last_posted( $author_id );
     857
     858        // Update poster IP
    862859        update_post_meta( $reply_id, '_bbp_author_ip', bbp_current_author_ip(), false );
    863860
Note: See TracChangeset for help on using the changeset viewer.