Making WordPress.org


Ignore:
Timestamp:
04/02/2020 02:23:28 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: Add audit log entries for plugin committer/support reps addition/removal.

Fixes #2717.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php

    r9094 r9682  
    280280        );
    281281
    282         $this->audit_log( 'Plugin approved.', $post_id );
     282        Tools::audit_log( 'Plugin approved.', $post_id );
    283283        wp_mail( $plugin_author->user_email, $subject, $content, 'From: plugins@wordpress.org' );
    284284    }
     
    322322        );
    323323
    324         $this->audit_log( 'Plugin rejected.', $post_id );
     324        Tools::audit_log( 'Plugin rejected.', $post_id );
    325325        wp_mail( $email, $subject, $content, 'From: plugins@wordpress.org' );
    326326    }
     
    362362        $post = get_post( $post_id );
    363363        if ( $post && 'approved' != $post->post_status ) {
    364             $this->audit_log( 'Plugin reopened.', $post_id );
     364            Tools::audit_log( 'Plugin reopened.', $post_id );
    365365        }
    366366    }
     
    385385        update_post_meta( $post_id, 'plugin_closed_date', current_time( 'mysql' ) );
    386386
    387         $this->audit_log( sprintf( 'Plugin closed. Reason: %s', $close_reason ), $post_id );
     387        Tools::audit_log( sprintf( 'Plugin closed. Reason: %s', $close_reason ), $post_id );
    388388    }
    389389
     
    406406        $new_owner = get_userdata( $post_after->post_author );
    407407
    408         $this->audit_log( sprintf(
     408        Tools::audit_log( sprintf(
    409409            'Ownership transferred to <a href="%s">%s</a>.',
    410             esc_url( '//profiles.wordpress.org/' . $new_owner->user_nicename ),
     410            esc_url( 'https://profiles.wordpress.org/' . $new_owner->user_nicename .'/' ),
    411411            $new_owner->user_login
    412412        ), $post_id );
    413413    }
    414414
    415     /**
    416      * Saves an audit_log comment for the plugin.
    417      *
    418      * @param string  $message The message for the audit log.
    419      * @param integer $post_id The Post ID.
    420      */
    421     public function audit_log( $message, $post_id ) {
    422         $user = wp_get_current_user();
    423 
    424         $comment = array(
    425             'comment_author'       => $user->display_name,
    426             'comment_author_email' => $user->user_email,
    427             'comment_author_url'   => $user->user_url,
    428             'comment_type'         => 'internal-note',
    429             'comment_post_ID'      => $post_id,
    430             'user_id'              => get_current_user_id(),
    431             'comment_content'      => $message,
    432         );
    433         wp_insert_comment( $comment );
    434     }
    435415}
Note: See TracChangeset for help on using the changeset viewer.