Changeset 9094
- Timestamp:
- 08/07/2019 10:45:11 PM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
r8900 r9094 27 27 private function __construct() { 28 28 add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 11, 3 ); 29 add_action( 'post_updated', array( $this, 'record_owner_change' ), 11, 3 ); 29 30 } 30 31 … … 384 385 update_post_meta( $post_id, 'plugin_closed_date', current_time( 'mysql' ) ); 385 386 386 $this->audit_log( sprintf( 'Plugin closed for: %s', $close_reason ), $post_id ); 387 $this->audit_log( sprintf( 'Plugin closed. Reason: %s', $close_reason ), $post_id ); 388 } 389 390 /** 391 * Records a plugin owner change. 392 * 393 * @param integer $post_id Post ID. 394 * @param WP_Post $post_after Post object following the update. 395 * @param WP_Post $post_before Post object before the update. 396 */ 397 public function record_owner_change( $post_id, $post_after, $post_before ) { 398 if ( 'plugin' !== $post_after->post_type ) { 399 return; 400 } 401 402 if ( $post_after->post_author === $post_before->post_author ) { 403 return; 404 } 405 406 $new_owner = get_userdata( $post_after->post_author ); 407 408 $this->audit_log( sprintf( 409 'Ownership transferred to <a href="%s">%s</a>.', 410 esc_url( '//profiles.wordpress.org/' . $new_owner->user_nicename ), 411 $new_owner->user_login 412 ), $post_id ); 387 413 } 388 414 … … 393 419 * @param integer $post_id The Post ID. 394 420 */ 395 p rivatefunction audit_log( $message, $post_id ) {421 public function audit_log( $message, $post_id ) { 396 422 $user = wp_get_current_user(); 397 423 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r9042 r9094 1519 1519 wp_cache_set( $result, $slug, 'plugin-slugs' ); 1520 1520 $result = get_post( $result ); 1521 1522 $owner = get_userdata( $result->post_author ); 1523 1524 Admin\Status_Transitions::instance()->audit_log( sprintf( 1525 'Submitted by <a href="%s">%s</a>.', 1526 esc_url( '//profiles.wordpress.org/' . $owner->user_nicename ), 1527 $owner->user_login 1528 ), $result->ID ); 1521 1529 } 1522 1530
Note: See TracChangeset
for help on using the changeset viewer.