Making WordPress.org

Changeset 11940


Ignore:
Timestamp:
07/06/2022 03:44:13 AM (3 years ago)
Author:
dd32
Message:

O2: Cross-posting: Use more generic capability checks to hopefully allow cross-posting to work for non-editors, such as in comments.

See #6389, #6052.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-o2-posting-access/wporg-o2-allow-crossposting.php

    r11587 r11940  
    2727        }
    2828
    29         // If the current user can't edit posts, they're not going to need this.
    30         if ( ! current_user_can( 'edit_posts' ) ) {
    31             return;
    32         }
    33 
    3429        $this->_current_blog_id = get_current_blog_id();
    3530
     
    9590        $data = [
    9691            'data'  => array_values( $xposts->site_suggestions() ),
    97             'limit' => 30, // Show all sites
     92            'limit' => 50, // Show all sites
    9893        ];
    9994
     
    112107     */
    113108    public function user_has_cap( $allcaps, $caps, $args, $user ) {
     109        if ( ! is_user_logged_in() ) {
     110            return $allcaps;
     111        }
     112
    114113        if ( $user->ID !== get_current_user_id() ) {
    115114            return $allcaps;
     
    189188                }
    190189
    191                 $correct = "make.wordpress.org/{$site}/";
     190                $correct = "{$current_site->domain}/{$site}/";
    192191                if ( $m[1] !== $correct ) {
    193192                    return str_replace( $m[1], $correct, $m[0] );
Note: See TracChangeset for help on using the changeset viewer.