Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide the signup tab if registrations are turned off #460

Merged
merged 1 commit into from
May 11, 2018

Conversation

joshcanhelp
Copy link
Contributor

No description provided.

@joshcanhelp joshcanhelp added this to the 3.6.0 milestone May 7, 2018
@@ -193,6 +193,10 @@ public function get_lock_options() {

$options_obj = array_replace_recursive( $extraOptions, $options_obj, $extended_settings );

if ( ! $this->wp_options->is_wp_registration_enabled() && ! isset( $options_obj["allowSignUp"] )) {
$options_obj["allowSignUp"] = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if is_wp_registration_enabled is false so that the first condition passes; but then the allowSignup is true. You would keep allowSignUp=true instead of turning it off (since is_wp_registration_enabled is false)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended. That would mean someone has {"allowSignUp":true} in their extra Lock settings and we want to respect that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but won't that fail due to wp_reg being disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the main pathway, yes, but some of that is hook-able so it can be overridden. These extra settings JSON fields say they will override all other settings and I want them to be able to do that, even if it's edge case

return users_can_register_signup_filter();
}
return get_site_option( 'users_can_register', 0 ) == 1;
return is_multisite() ? users_can_register_signup_filter() : get_site_option( 'users_can_register' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would that second value be the same to get_site_option( 'users_can_register', 0 ) == 1 (previous)? Is this tested somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common practice. get_site_option( 'users_can_register', 0 ) == 1 means "get the option users_can_register and if it doesn't exist use 0 and then loosely compare that to 1."

If users_can_register is on, it will be a "1" (true), if it's off it will be a "0" (false), and if it's not set, get_site_options() will return an explicit false. Codex

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for that link ⚡️

@joshcanhelp joshcanhelp force-pushed the change-remove-signup-if-registration-off branch from 2f7557c to 5b08e93 Compare May 10, 2018 22:02
Copy link
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌮

@joshcanhelp joshcanhelp merged commit 69abc2a into dev May 11, 2018
@joshcanhelp joshcanhelp deleted the change-remove-signup-if-registration-off branch May 11, 2018 20:41
@joshcanhelp joshcanhelp mentioned this pull request Jun 5, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants