Making WordPress.org

Changeset 12470


Ignore:
Timestamp:
03/14/2023 08:43:47 AM (2 years ago)
Author:
dd32
Message:

Helpscout: Link to the plugin in review, if the email subject matches the expected format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/common.php

    r12469 r12470  
    136136    ];
    137137
    138     // Reported themes, shortcut, assume the slug is the title.. since it is..
     138    // Reported themes, shortcut, assume the slug is the title.. since it always is..
    139139    if ( str_starts_with( $subject, 'Reported Theme:' ) ) {
    140140        $possible['themes'][] = sanitize_title_with_dashes( trim( explode( ':', $request->ticket->subject )[1] ) );
     141    }
     142
     143    // Plugin reviews, match the format of "[WordPress Plugin Directory] {Type Of Email}: {Plugin Title}"
     144    if ( preg_match( '!^(Re: )?\[WordPress Plugin Directory\][^:]+: (?P<title>.+)$!i', $subject, $m ) ) {
     145        switch_to_blog( WPORG_PLUGIN_DIRECTORY_BLOGID );
     146        $plugins = get_posts( [
     147            'title'       => trim( $m['title'] ),
     148            'post_type'   => 'plugin',
     149            'post_status' => 'any',
     150        ] );
     151        restore_current_blog();
     152
     153        // As we're searching by title, multiple plugins may come up.
     154        foreach ( $plugins as $plugin ) {
     155            $possible['plugins'][] = $plugin->post_name;
     156        }
    141157    }
    142158
Note: See TracChangeset for help on using the changeset viewer.