Making WordPress.org

Ticket #813: 813.2.patch

File 813.2.patch, 937 bytes (added by ocean90, 10 years ago)
  • wporg-specifics.php

     
    1111                $this->add_action( 'before_login_form' );
    1212                $this->add_filter( 'gp_url_profile', array( 'args' => 2 ) );
    1313                $this->add_filter( 'routes' );
     14                $this->add_filter( 'projects', array( 'args' => 2 ) );
    1415        }
    1516
    1617        function before_login_form() {
     
    2526                unset( $routes['get:/profile/(.+?)'] );
    2627                return $routes;
    2728        }
     29
     30        function projects( $sub_projects, $parent_id ) {
     31                if ( 1 != $parent_id && 13 != $parent_id ) { // 1 = WordPress, 13 = BuddyPress
     32                        return $sub_projects;
     33                }
     34
     35                /*
     36                 * Natural sorting for sub projects.
     37                 *
     38                 * 3.0.x
     39                 * 4.0.x
     40                 * 3.1.x
     41                 * 4.1.x
     42                 *  =>
     43                 * 4.1.x
     44                 * 4.0.x
     45                 * 3.1.x
     46                 * 3.0.x
     47                 */
     48                usort( $sub_projects, function( $a, $b ) {
     49                        return - strcasecmp( $a->name, $b->name );
     50                });
     51
     52                return $sub_projects;
     53        }
    2854}
    2955GP::$plugins->wporg_specifics = new GP_WPorg_Specifics;