Making WordPress.org

Changeset 12492


Ignore:
Timestamp:
03/24/2023 05:11:34 AM (11 months ago)
Author:
dd32
Message:

Plugin Directory: Add ability to define a 'Plugin Author Notice' for plugins.

This is a notice that plugin reviewers can set, that is then visible on the plugins page by plugin authors/committers.

The intent is that this can inform plugin authors why their plugin has been closed when they miss the email.

Fixse #6880.
Closes https://github.com/WordPress/wordpress.org/pull/135.

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
1 added
3 edited

Legend:

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

    r12489 r12492  
    6464
    6565        add_action( 'save_post', array( __NAMESPACE__ . '\Metabox\Release_Confirmation', 'save_post' ) );
     66        add_action( 'save_post', array( __NAMESPACE__ . '\Metabox\Author_Notice', 'save_post' ) );
    6667    }
    6768
     
    472473                array( __NAMESPACE__ . '\Metabox\Commits', 'display' ),
    473474                'plugin', 'normal', 'low'
     475            );
     476
     477            add_meta_box(
     478                'plugin-author-notice',
     479                __( 'Author Notice (Displayed on the plugins page to Plugin Authors)', 'wporg-plugins' ),
     480                array( __NAMESPACE__ . '\Metabox\Author_Notice', 'display' ),
     481                'plugin', 'normal', 'high'
    474482            );
    475483        }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r12336 r12492  
    129129    if ( ! in_array( get_post_status( $post ), [ 'rejected', 'closed' ], true ) ) {
    130130        echo wp_kses_post( get_plugin_status_notice( $post ) );
    131     };
     131    }
    132132}
    133133
     
    636636    }
    637637}
     638
     639/**
     640 * Displays a persistent notice to the plugin author.
     641 */
     642function the_author_notice( $post = null ) {
     643    $post = get_post( $post );
     644
     645    if ( ! current_user_can( 'plugin_admin_edit', $post->ID ) ) {
     646        return;
     647    }
     648
     649    $notice = get_post_meta( $post->ID, '_author_notice', true );
     650
     651    if ( $notice && $notice['type'] && $notice['html'] ) {
     652        printf(
     653            '<div class="notice notice-alt notice-%s">%s</div>',
     654            esc_attr( $notice['type'] ),
     655            '<p><strong>' . __( 'A note from the Plugin Review team, visible only to the plugin author &amp; committers.', 'wporg-plugins' ) . '</strong></p>' .
     656            wp_kses_post( $notice['html'] ) // Should have wrapping <p> tags.
     657        );
     658    }
     659}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r12319 r12492  
    2525
    2626    <header class="plugin-header">
     27        <?php the_author_notice(); ?>
    2728        <?php the_active_plugin_notice(); ?>
    2829        <?php the_unconfirmed_releases_notice(); ?>
Note: See TracChangeset for help on using the changeset viewer.