Skip to content

Commit

Permalink
Update security/class-private-sites.php
Browse files Browse the repository at this point in the history
Co-authored-by: Volodymyr Kolesnykov <[email protected]>
  • Loading branch information
rebeccahum and sjinks committed Sep 28, 2023
1 parent 3297c96 commit 1d64f9a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions security/class-private-sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,21 @@ public function disable_blog_public_ui() {
wp_register_script( 'vip-disable-blog-public-option-ui', false, array(), '0.1', true );
wp_enqueue_script( 'vip-disable-blog-public-option-ui' );
$js_code = <<<JS
document.addEventListener("DOMContentLoaded", function() {
function onContentLoaded(callback) {
if (document.readyState !== 'loading') {
callback();
} else {
document.addEventListener('DOMContentLoaded', callback);
}
}
onContentLoaded(function() {
function updateProperty(selector, property, value) {
const element = document.querySelector(selector);
if (element) {
element[property] = value;
}
}
var checkbox = 'tr.option-site-visibility input#blog_public[type="checkbox"]';
if (document.querySelector(checkbox)) {
updateProperty(checkbox, 'disabled', true);
Expand Down

0 comments on commit 1d64f9a

Please sign in to comment.