Making WordPress.org


Ignore:
Timestamp:
12/15/2023 03:08:48 AM (9 months ago)
Author:
tellyworth
Message:

Plugin Directory: fix button text for Test Preview

Props @jeffpaul.
See #7251.

File:
1 edited

Legend:

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

    r13035 r13061  
    726726     *
    727727     * @param int|\WP_Post|null $post    Optional. Post ID or post object. Defaults to global $post.
     728     * @param 'view'|'edit'     $context Optional. 'view' to check if preview is available for public viewing. 'edit' to also check if available for current user to test. Default: view.
    728729     * @return bool True if a preview is available and the current user is permitted to see it.
    729730     */
    730     public static function is_preview_available( $post = null ) {
     731    public static function is_preview_available( $post = null, $context = 'view' ) {
    731732
    732733        if ( self::preview_link( $post ) ) {
    733             // Plugin committers can always use the plugin preview button if it exists.
    734             if ( current_user_can( 'plugin_admin_edit', $post ) ) {
     734            // Plugin committers can use the plugin preview button to test if a blueprint exists.
     735            if ( 'edit' === $context && current_user_can( 'plugin_admin_edit', $post ) ) {
    735736                return true;
    736737            }
Note: See TracChangeset for help on using the changeset viewer.