Add WordPay integration
This commit is contained in:
@@ -64,6 +64,22 @@ class SportsPress_User_Registration {
|
||||
'checkboxgroup' => 'start',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Add a team name field to signup form', 'sportspress' ),
|
||||
'id' => 'sportspress_registration_team_input',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Add a team selector to signup form', 'sportspress' ),
|
||||
'id' => 'sportspress_registration_team_select',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => '',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Create player profiles for new users', 'sportspress' ),
|
||||
'id' => 'sportspress_registration_add_player',
|
||||
@@ -85,16 +101,35 @@ class SportsPress_User_Registration {
|
||||
$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : '';
|
||||
?>
|
||||
<p>
|
||||
<label for="first_name"><?php _e( 'First Name', 'themeboy' ) ?><br />
|
||||
<input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr( wp_unslash( $first_name ) ); ?>" size="25" /></label>
|
||||
<label for="first_name"><?php _e( 'First Name', 'sportspress' ) ?><br />
|
||||
<input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr( wp_unslash( $first_name ) ); ?>" size="25" /></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="last_name"><?php _e( 'Last Name', 'themeboy' ) ?><br />
|
||||
<input type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr( wp_unslash( $last_name ) ); ?>" size="25" /></label>
|
||||
<label for="last_name"><?php _e( 'Last Name', 'sportspress' ) ?><br />
|
||||
<input type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr( wp_unslash( $last_name ) ); ?>" size="25" /></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( 'yes' === get_option( 'sportspress_registration_team_select', 'no' ) ) {
|
||||
?>
|
||||
<p>
|
||||
<label for="sp_team"><?php _e( 'Team', 'sportspress' ) ?><br />
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team',
|
||||
'values' => 'ID',
|
||||
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'Team', 'sportspress' ) ),
|
||||
'property' => 'style="width:100%;height:36px;margin-bottom:16px"',
|
||||
);
|
||||
sp_dropdown_pages( $args );
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
wp_nonce_field( 'submit_team', 'sp_register_form_player' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +153,27 @@ class SportsPress_User_Registration {
|
||||
}
|
||||
}
|
||||
|
||||
// Add team from team name
|
||||
if ( isset( $_POST['sp_register_form_team'] ) && wp_verify_nonce( $_POST['sp_register_form_team'], 'submit_team_name' ) ) {
|
||||
if ( ! empty( $_POST['team_name'] ) ) {
|
||||
$team_name = trim( $_POST['team_name'] );
|
||||
$post['post_type'] = 'sp_team';
|
||||
$post['post_title'] = $team_name;
|
||||
$post['post_author'] = $user_id;
|
||||
$post['post_status'] = 'draft';
|
||||
$id = wp_insert_post( $post );
|
||||
}
|
||||
}
|
||||
|
||||
// Save team
|
||||
if ( isset( $_POST['sp_register_form_player'] ) && wp_verify_nonce( $_POST['sp_register_form_player'], 'submit_team' ) ) {
|
||||
if ( ! empty( $_POST['sp_team'] ) ) {
|
||||
$team = trim( $_POST['sp_team'] );
|
||||
if ( $team <= 0 ) $team = 0;
|
||||
update_user_meta( $user_id, 'sp_team', $team );
|
||||
}
|
||||
}
|
||||
|
||||
// Add player
|
||||
if ( 'yes' === get_option( 'sportspress_registration_add_player', 'no' ) ) {
|
||||
if ( ! sizeof( $parts ) && ! empty( $_POST['user_login'] ) ) {
|
||||
@@ -129,8 +185,13 @@ class SportsPress_User_Registration {
|
||||
$post['post_type'] = 'sp_player';
|
||||
$post['post_title'] = trim( $name );
|
||||
$post['post_author'] = $user_id;
|
||||
$post['post_status'] = 'publish';
|
||||
$post['post_status'] = 'draft';
|
||||
$id = wp_insert_post( $post );
|
||||
|
||||
if ( isset( $team ) && $team ) {
|
||||
update_post_meta( $id, 'sp_team', $team );
|
||||
update_post_meta( $id, 'sp_current_team', $team );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user