Making WordPress.org


Ignore:
Timestamp:
05/02/2024 07:05:00 AM (9 months ago)
Author:
dd32
Message:

Plugin Directory: Centralise the Helpscout email table query code.

See #7385.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

    r13649 r13650  
    738738     */
    739739    public static function find_review_email( $post ) {
    740         global $wpdb;
    741 
    742740        if ( ! in_array( $post->post_status, [ 'new', 'pending' ] ) || ! $post->post_name ) {
    743741            return false;
    744742        }
    745743
    746         // Find the latest email for this plugin that looks like a review email.
    747         return $wpdb->get_row( $wpdb->prepare(
    748             "SELECT emails.*
    749                 FROM %i emails
    750                     JOIN %i meta ON emails.id = meta.helpscout_id
    751                 WHERE meta.meta_key = 'plugins' AND meta.meta_value = %s
    752                     AND emails.subject LIKE %s
    753                 ORDER BY `created` DESC
    754                 LIMIT 1",
    755             "{$wpdb->base_prefix}helpscout",
    756             "{$wpdb->base_prefix}helpscout_meta",
    757             $post->post_name,
    758             '%Review in Progress:%' // The subject line of the review email.
    759         ) );
     744        return Tools::get_helpscout_emails( $post, [ 'subject' => 'Review in Progress:', 'limit' => 1 ] );
    760745    }
    761746
Note: See TracChangeset for help on using the changeset viewer.