Skip to content

Commit d4b08f6

Browse files
Merge pull request #428 from 10up/feature/wp-compat-check-7.1
WordPress 7.1 Compatibility Updates
2 parents 5d8d872 + fd22d7f commit d4b08f6

5 files changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
core:
5454
- {name: 'WP latest', version: 'latest'}
5555
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
56-
- {name: 'WP minimum', version: 'WordPress/WordPress#6.6'}
56+
- {name: 'WP minimum', version: 'WordPress/WordPress#6.9'}
5757

5858
steps:
5959
- name: Checkout

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: 10up, jakemgold, rcbth, thinkoomph, tlovett1, jeffpaul, nomnom99
33
Donate link: https://10up.com/plugins/restricted-site-access-wordpress/
44
Tags: privacy, restrict, limited, permissions, security
5-
Tested up to: 7.0
5+
Tested up to: 7.1
66
Stable tag: 7.6.1
77
License: GPL-2.0-or-later
88
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html

restricted_site_access.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://10up.com/plugins/restricted-site-access-wordpress/
55
* Description: <strong>Limit access your site</strong> to visitors who are logged in or accessing the site from a set of specific IP addresses. Send restricted visitors to the log in page, redirect them, or display a message or page. <strong>Powerful control over redirection</strong>, including <strong>SEO friendly redirect headers</strong>. Great solution for Extranets, publicly hosted Intranets, or parallel development sites.
66
* Version: 7.6.1
7-
* Requires at least: 6.6
7+
* Requires at least: 6.9
88
* Requires PHP: 7.4
99
* Author: 10up
1010
* Author URI: https://10up.com
@@ -150,7 +150,7 @@ public static function add_actions() {
150150

151151
add_action( 'activate_' . self::$basename, array( __CLASS__, 'activation' ), 10, 1 );
152152
add_action( 'deactivate_' . self::$basename, array( __CLASS__, 'deactivation' ), 10, 1 );
153-
add_action( 'wpmu_new_blog', array( __CLASS__, 'set_defaults' ) );
153+
add_action( 'wp_initialize_site', array( __CLASS__, 'set_defaults' ), 10, 1 );
154154
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_admin_script' ) );
155155
add_action( 'wp_ajax_rsa_notice_dismiss', array( __CLASS__, 'ajax_notice_dismiss' ) );
156156

@@ -302,11 +302,17 @@ public static function ajax_notice_dismiss() {
302302
}
303303

304304
/**
305-
* Set RSA defaults for new site.
305+
* Set RSA defaults for a new site.
306306
*
307-
* @param int $blog_id New site/blog ID.
307+
* @param WP_Site|int $new_site New site object or ID.
308308
*/
309-
public static function set_defaults( $blog_id ) {
309+
public static function set_defaults( $new_site ) {
310+
$new_site = get_site( $new_site );
311+
312+
if ( ! $new_site ) {
313+
return;
314+
}
315+
310316
if ( 'enforce' === self::get_network_mode() ) {
311317
return;
312318
}
@@ -315,7 +321,7 @@ public static function set_defaults( $blog_id ) {
315321
$blog_public = get_site_option( 'blog_public', 2 );
316322

317323
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.switch_to_blog_switch_to_blog -- Only used to set options/change DB prefix.
318-
switch_to_blog( $blog_id );
324+
switch_to_blog( $new_site->id );
319325
update_option( 'rsa_options', self::sanitize_options( $network_options ) );
320326
update_option( 'blog_public', (int) $blog_public );
321327
restore_current_blog();

tests/php/multisite/test-settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function test_set_defaults() {
141141

142142
restore_current_blog();
143143

144-
$rsa::set_defaults( $site->blog_id, null, null, null, null, null );
144+
$rsa::set_defaults( $site );
145145

146146
switch_to_blog( $site->blog_id );
147147

@@ -173,7 +173,7 @@ public function test_set_defaults() {
173173

174174
restore_current_blog();
175175

176-
$rsa::set_defaults( $site->blog_id, null, null, null, null, null );
176+
$rsa::set_defaults( $site );
177177

178178
switch_to_blog( $site->blog_id );
179179

tests/php/test-actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function test_actions() {
1212
$this->assertSame( 10, has_action( 'wp_ajax_rsa_ip_check', array( 'Restricted_Site_Access', 'ajax_rsa_ip_check' ) ) );
1313
$this->assertSame( 10, has_action( 'activate_' . RSA_TEST_PLUGIN_BASENAME, array( 'Restricted_Site_Access', 'activation' ) ) );
1414
$this->assertSame( 10, has_action( 'deactivate_' . RSA_TEST_PLUGIN_BASENAME, array( 'Restricted_Site_Access', 'deactivation' ) ) );
15-
$this->assertSame( 10, has_action( 'wpmu_new_blog', array( 'Restricted_Site_Access', 'set_defaults' ) ) );
15+
$this->assertSame( 10, has_action( 'wp_initialize_site', array( 'Restricted_Site_Access', 'set_defaults' ) ) );
1616
$this->assertSame( 10, has_action( 'admin_enqueue_scripts', array( 'Restricted_Site_Access', 'enqueue_admin_script' ) ) );
1717
$this->assertSame( 10, has_action( 'wp_ajax_rsa_notice_dismiss', array( 'Restricted_Site_Access', 'ajax_notice_dismiss' ) ) );
1818
}

0 commit comments

Comments
 (0)