Changeset 7024 for trunk/src/includes/common/engagements.php
- Timestamp:
- 12/11/2019 04:05:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/engagements.php
r7006 r7024 612 612 private function get_cache_key( $meta_key = '', $object_id = 0 ) { 613 613 614 // No negative numbers in cache keys 615 $object_id = absint( $object_id ); 616 614 617 // Maybe guess at post type 615 618 $post_type = ! empty( $object_id ) … … 641 644 } 642 645 643 // Return the old (pluralized) user option key 644 return $key;646 // Return the old (pluralized) user option key with object ID appended 647 return "{$key}{$object_id}"; 645 648 } 646 649 … … 661 664 $cache_key = $this->get_cache_key( $meta_key, $object_id ); 662 665 663 return wp_cache_get( $cache_key, 'bbpress_ users' );666 return wp_cache_get( $cache_key, 'bbpress_posts' ); 664 667 } 665 668 … … 740 743 $retval = update_user_option( $user_id, $option_key, $object_ids ); 741 744 742 // Delete cache , if successful743 if ( true === $retval ) {745 // Delete cache if successful (accounts for int & true) 746 if ( false !== $retval ) { 744 747 $this->cache_delete( $meta_key, $object_id ); 745 748 } … … 777 780 : delete_user_option( $user_id, $option_key ); 778 781 779 // Delete cache , if successful780 if ( true === $retval ) {782 // Delete cache if successful (accounts for int & true) 783 if ( false !== $retval ) { 781 784 $this->cache_delete( $meta_key, $object_id ); 782 785 } … … 806 809 $object_ids = $this->parse_comma_list( get_user_option( $option_key, $user_id ) ); 807 810 808 // Attempt to delete the 811 // Attempt to delete the user option 809 812 $retval = delete_user_option( $user_id, $option_key ); 810 813 … … 945 948 $object_ids = $this->parse_comma_list( get_user_option( $option_key, $user_id ) ); 946 949 947 // Maybe trick WP_Query into ".ID IN ( )"950 // Maybe trick WP_Query into ".ID IN (0)" to return no results 948 951 if ( empty( $object_ids ) ) { 949 952 $object_ids = array( 0 );
Note: See TracChangeset
for help on using the changeset viewer.