Making WordPress.org


Ignore:
Timestamp:
10/16/2018 05:09:51 PM (7 years ago)
Author:
vedjain
Message:

WordCamp: Add log with with timestamp when status is changed.

This will allow us to query status changes within a given timeperiod. Also minor fixes in meetup public status list and meta keys.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/class-event-admin.php

    r7640 r7733  
    263263        $new_status = get_post_status_object( $new_status );
    264264
    265         add_post_meta(
     265        $log_id = add_post_meta(
    266266            $post->ID, '_status_change', array(
    267267                'timestamp' => time(),
     
    270270            )
    271271        );
    272     }
    273 
     272        // Encoding $post_type and status_change meta ID in key so that we can fetch it if needed while simultaneously be able to have a where clause on value
     273        // Because of the way MySQL works, it will still be able to use index on meta_key when searching, as long as we are querying just the prefix
     274        if ( $log_id ) {
     275            add_post_meta( $post->ID, "_status_change_log_$post->post_type $log_id", time() );
     276        }
     277    }
    274278
    275279    /**
Note: See TracChangeset for help on using the changeset viewer.