Conversation
|
This doesn't seem to be working. I set the default to be restrict, created a new site, and navigated to that site in incognito mode. I was shown the site and not the access denied message I created. |
|
I couldn't replicate the error you mention. |
|
@tlovett1 |
| Cache.page_field = $( document.getElementById( 'rsa_page' ) ).closest( 'tr' ); | ||
|
|
||
| if ( ! document.getElementById( 'blog-restricted' ).checked ) { | ||
| if ( document.getElementById( 'blog-restricted' ) != null && ! document.getElementById( 'blog-restricted' ).checked ) { |
There was a problem hiding this comment.
Use identical operators !==
restricted_site_access.php
Outdated
| <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( $blog_public, '1') ?>> | ||
| <label for="blog-public">Allow search engines to index this site</label><br> | ||
| <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( $blog_public, '0') ?>> | ||
| <label for="blog-norobots">Discourage search engines from indexing this site</label> |
restricted_site_access.php
Outdated
| if( 'rsa_options' === $option_name ){ | ||
| $value = self::sanitize_options( $_POST[$option_name] ); | ||
| }else{ | ||
| $value = wp_unslash( $_POST[$option_name] ); |
|
@ivankristianto seems to be working for me now. Not sure why I had an issue before. I left comments on the code. |
|
@tlovett1 I fixed and tidy up the code. Can you please check again? |
restricted_site_access.php
Outdated
| <th scope="row"><?php _e( 'Handle restricted visitors', 'restricted-site-access' ) ?></th> | ||
| <td> | ||
| <?php | ||
| self::settings_field_handling( [] ); |
There was a problem hiding this comment.
[] array notation is PHP 5.4+. We need to support PHP 5.2.
| <tr> | ||
| <th scope="row"><?php _e( 'Site Visibility', 'restricted-site-access' ) ?></th> | ||
| <?php | ||
| if ( FALSE === get_site_option( 'blog_public' ) ){ |
| // If we have network activated and rsa_mode = default, and rsa_options is not exist, we set it | ||
| if( 'default' === self::$rsa_network_mode && defined( 'RSA_IS_NETWORK' ) && RSA_IS_NETWORK && empty( self::$rsa_options ) ){ | ||
| self::$rsa_options = (array) get_site_option( 'rsa_options' ); | ||
| update_option( 'rsa_options', self::$rsa_options ); |
There was a problem hiding this comment.
Shouldn't this be update_site_option?
|
|
||
| $network_activated = Restricted_Site_Access::is_network( plugin_basename( __FILE__ ) ); | ||
|
|
||
| if ( $network_activated ) { |
There was a problem hiding this comment.
Just define RSA_IS_NETWORK to false otherwise then you simplify the IF check throughout the code
| } | ||
|
|
||
| if ( defined( 'RSA_IS_NETWORK' ) && RSA_IS_NETWORK ){ | ||
| self::$rsa_network_mode = get_site_option( 'rsa_mode' ); |
There was a problem hiding this comment.
You are checking this variable elsewhere which might not be defined. This will throw a notice.
| //If rsa_mode==enforce we override the rsa_options | ||
| if( 'enforce' === self::$rsa_network_mode && RSA_IS_NETWORK ){ | ||
| $blog_public = get_site_option( 'blog_public', 2 ); | ||
| self::$rsa_options = get_site_option( 'rsa_options' ); |
There was a problem hiding this comment.
We already set this in set_option_defaults
This PR is to add the Network Options.
What it does:
restricted_accessto allow network enforce modeset_option_defaultsto allow network get_site_options