Uncheck player registration options by default

This commit is contained in:
Brian Miyaji
2017-03-20 11:52:46 +11:00
parent 75726fb838
commit 6f0d1c7185

View File

@@ -59,7 +59,7 @@ class SportsPress_User_Registration {
'title' => __( 'User Registration', 'sportspress' ), 'title' => __( 'User Registration', 'sportspress' ),
'desc' => __( 'Add name fields to signup form', 'sportspress' ), 'desc' => __( 'Add name fields to signup form', 'sportspress' ),
'id' => 'sportspress_registration_name_inputs', 'id' => 'sportspress_registration_name_inputs',
'default' => 'yes', 'default' => 'no',
'type' => 'checkbox', 'type' => 'checkbox',
'checkboxgroup' => 'start', 'checkboxgroup' => 'start',
), ),
@@ -67,7 +67,7 @@ class SportsPress_User_Registration {
array( array(
'desc' => __( 'Create player profiles for new users', 'sportspress' ), 'desc' => __( 'Create player profiles for new users', 'sportspress' ),
'id' => 'sportspress_registration_add_player', 'id' => 'sportspress_registration_add_player',
'default' => 'yes', 'default' => 'no',
'type' => 'checkbox', 'type' => 'checkbox',
'checkboxgroup' => 'end', 'checkboxgroup' => 'end',
), ),
@@ -80,7 +80,7 @@ class SportsPress_User_Registration {
* Add name fields to user registration form. * Add name fields to user registration form.
*/ */
public static function register_form() { public static function register_form() {
if ( 'yes' === get_option( 'sportspress_registration_name_inputs', 'yes' ) ) { if ( 'yes' === get_option( 'sportspress_registration_name_inputs', 'no' ) ) {
$first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : ''; $first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : '';
$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : ''; $last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : '';
?> ?>
@@ -104,7 +104,7 @@ class SportsPress_User_Registration {
$parts = array(); $parts = array();
// Save first and last name // Save first and last name
if ( 'yes' === get_option( 'sportspress_registration_name_inputs', 'yes' ) ) { if ( 'yes' === get_option( 'sportspress_registration_name_inputs', 'no' ) ) {
if ( ! empty( $_POST['first_name'] ) ) { if ( ! empty( $_POST['first_name'] ) ) {
$meta = trim( $_POST['first_name'] ); $meta = trim( $_POST['first_name'] );
$parts[] = $meta; $parts[] = $meta;
@@ -119,7 +119,7 @@ class SportsPress_User_Registration {
} }
// Add player // Add player
if ( 'yes' === get_option( 'sportspress_registration_add_player', 'yes' ) ) { if ( 'yes' === get_option( 'sportspress_registration_add_player', 'no' ) ) {
if ( ! sizeof( $parts ) && ! empty( $_POST['user_login'] ) ) { if ( ! sizeof( $parts ) && ! empty( $_POST['user_login'] ) ) {
$parts[] = trim( $_POST['user_login'] ); $parts[] = trim( $_POST['user_login'] );
} }