Making WordPress.org

Changeset 5460


Ignore:
Timestamp:
05/02/2017 04:27:48 PM (6 years ago)
Author:
Otto42
Message:

Plugin Directory: Add 'rejected' to slugs of rejected plugins. Fixes #2737. Props @SergeyBiryukov

File:
1 edited

Legend:

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

    r5318 r5460  
    173173        }
    174174
     175        // Prevent recursive calling via wp_update_post().
     176        remove_action( 'rejected_plugin', array( $this, 'rejected' ), 10 );
     177
     178        // Change slug to 'rejected-plugin-name-rejected' to free up 'plugin-name'.
     179        wp_update_post( array(
     180            'ID'        => $post_id,
     181            'post_name' => sprintf( 'rejected-%s-rejected', $post->post_name )
     182        ) );
     183
     184        // Re-add action.
     185        add_action( 'rejected_plugin', array( $this, 'rejected' ), 10, 2 );
     186
    175187        // Send email.
    176188        $email   = get_user_by( 'id', $post->post_author )->user_email;
Note: See TracChangeset for help on using the changeset viewer.