Making WordPress.org

Changeset 5248


Ignore:
Timestamp:
04/05/2017 04:50:33 AM (10 years ago)
Author:
dd32
Message:

Plugin Directory: Rename the Admin section to Advanced and enable all users to view it (including logged out anonymous users).

See #2365

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
5 edited
2 moved

Legend:

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

    r4390 r5248  
    3030                                // Fall through
    3131
     32                        // Although we no longer have a admin view, this capability is still used to determine if the current user is a committer/contributor.
    3233                        case 'plugin_admin_view':
    3334                                // Committers + Contributors.
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r5217 r5248  
    440440
    441441                // Handle plugin admin requests
    442                 add_rewrite_rule( '^([^/]+)/admin/?$', 'index.php?name=$matches[1]&plugin_admin=1', 'top' );
     442                add_rewrite_rule( '^([^/]+)/advanced/?$', 'index.php?name=$matches[1]&plugin_advanced=1', 'top' );
    443443
    444444                // Handle the old plugin tabs URLs.
    … …  
    961961                $vars[] = 'redirect_plugin';
    962962                $vars[] = 'redirect_plugin_tab';
    963                 $vars[] = 'plugin_admin';
     963                $vars[] = 'plugin_advanced';
    964964
    965965                return $vars;
    … …  
    10501050                        }
    10511051
     1052                        // Browse 404's
     1053                        if ( 'browse' === $path[2] ) {
     1054                                wp_safe_redirect( home_url( '/browse/featured/' ) );
     1055                                die();
     1056                        }
     1057
    10521058                        // Otherwise, handle a plugin redirect.
    10531059                        if ( $path[2] && ( $plugin = self::get_plugin_post( $path[2] ) ) ) {
    … …  
    10721078                }
    10731079
    1074                 // Filter access to the plugin administration area. Only certain users are allowed access.
    1075                 if ( get_query_var( 'plugin_admin' )  &&
    1076                         ! current_user_can(
    1077                                 'plugin_admin_view',
    1078                                 $post = Plugin_Directory::get_plugin_post( get_query_var( 'name' ) )
    1079                         )
    1080                 ) {
    1081                         wp_safe_redirect( get_permalink( $post ) );
    1082                         die();
    1083                 }
    10841080        }
    10851081
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php

    r5210 r5248  
    7373                        <?php endif; ?>
    7474
    75                         <?php if ( current_user_can( 'plugin_admin_view', $post ) ) : ?>
     75                        <?php if ( ! get_query_var( 'plugin_advanced' ) ) : ?> 
    7676                                <li class="hide-if-no-js">
    7777                                        <?php
    78                                                 printf( __( 'Admin access: %s', 'wporg-plugins' ),
    79                                                         sprintf( '<strong><a class="plugin-admin" href="%s">%s</a></strong>', esc_url( get_permalink() . 'admin/' ), __( 'View Admin', 'wporg-plugins' ) )
    80                                                 );
     78                                                printf( '<strong><a class="plugin-admin" href="%s">%s</a></strong>', esc_url( get_permalink() . 'advanced/' ), __( 'Advanced View', 'wporg-plugins' ) );
    8179                                        ?>
    8280                                </li>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r5245 r5248  
    7474        ) );
    7575
    76         if ( get_query_var( 'plugin_admin' ) ) {
     76        if ( get_query_var( 'plugin_advanced' ) ) {
    7777                wp_enqueue_script( 'google-jsapi', 'https://www.google.com/jsapi', array(), false, true );
    7878                wp_enqueue_script( 'wporg-plugins-stats', get_template_directory_uri() . '/js/stats.js', array( 'jquery', 'google-jsapi' ), '20170328', true );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-sidebar-advanced.php

    r5243 r5248  
    1515);
    1616
    17 the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Meta',            array(), $widget_args );
    18 the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Committers',      array(), $widget_args );
    19 the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Contributors',    array(), array(
     17the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Meta',    array(), $widget_args );
     18the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Ratings',    array(), $widget_args );
     19the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Support',    array(), $widget_args );
     20       
     21// If the user is not a contributor/committer for the plugin, we'll show the Donate metabox instead of the committer metabox.
     22if ( current_user_can( 'plugin_admin_view', $post ) ) {
     23        the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Committers', array(), $widget_args );
     24} else {
     25        the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Donate', array(), $widget_args );
     26}
     27
     28the_widget( 'WordPressdotorg\Plugin_Directory\Widgets\Contributors', array(), array(
    2029        'before_title' => '<h4 class="widget-title">',
    2130        'after_title'  => '</h4>',
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r5210 r5248  
    120120        <div class="entry-content">
    121121                <?php
    122                 if ( get_query_var( 'plugin_admin' ) ) :
    123                         get_template_part( 'template-parts/section-admin' );
     122                if ( get_query_var( 'plugin_advanced' ) ) :
     123                        get_template_part( 'template-parts/section-advanced' );
    124124                else:
    125125                        $plugin_sections = Template::get_plugin_sections();
    … …  
    148148                                get_template_part( 'template-parts/section' );
    149149                        endforeach;
    150                 endif; // plugin_admin
     150                endif; // plugin_advanced
    151151                ?>
    152152        </div><!-- .entry-content -->
    … …  
    154154        <div class="entry-meta">
    155155                <?php
    156                 get_template_part( 'template-parts/plugin-sidebar', ( get_query_var( 'plugin_admin' ) ? 'admin' : '' ) );
     156                get_template_part( 'template-parts/plugin-sidebar', ( get_query_var( 'plugin_avanced' ) ? 'advanced' : '' ) );
    157157                ?>
    158158        </div><!-- .entry-meta -->
Note: See TracChangeset for help on using the changeset viewer.