I know that there is other similar questions but the error is caused by different reasons with different solution.
I have a Wordpress registration form template file that work perfect with this line, the phone number is captured and send to client profile/DB :
<input type="text" name="user_phone" id="user_phone" class="input" placeholder="<?php _e('Telefon', ET_DOMAIN);?>" value="<?php echo esc_attr( stripslashes( $user_phone ) ); ?>" tabindex="25"></div>
I have tried to use the same line on social registration form in order for the client to share the phone number but the phone number its saved on DB/client profile. This is the error on debug file:
Undefined index: user_phone in /home/admin/public_html/mysite.net/wp-content/plugins/sms-verification/sms-verification.php on line 333
sms-verification.php is a plugin file,
This is line 333 from debug error :
$phone = $_POST['user_phone'];
Function context of above line:
function user_register( $user_id ) {
$enabled = wedevs_sms_get_option( 'register_form' );
$phone = $_POST['user_phone'];
if ( $enabled == 'on' ) {
$gateway_obj = WeDevs_SMS_Gateways::instance();
$status = $gateway_obj->send( $phone );
update_user_meta( $user_id, 'sms_registered', 'yes' );
update_user_meta( $user_id, 'wedevssms_mobile', $phone );
update_user_meta( $user_id, 'sms_verified', 0 );
//if sms sent successfully, update the code
//else, insert a random code to the profile
if ( $status['success'] == true ) {
update_user_meta( $user_id, 'wedevssms_referenceno', $status['code'] );
} else {
update_user_meta( $user_id, 'wedevssms_referenceno', rand( 1000, 9999 ) );
}
}
}
social registration form:
<form id="form_username" method="post" action="">
<div class="fre-input-field">
<input type="hidden" name="et_nonce" value="<?php echo wp_create_nonce( 'authentication' ) ?>">
<input type="text" name="user_phone" id="user_phone" class="input" placeholder="<?php _e('Telefon', ET_DOMAIN);?>" value="<?php echo esc_attr( stripslashes( $user_phone ) ); ?>" tabindex="25">
<input type="hidden" name="user_email" value="<?php if ( isset( $auth['user_email'] ) ) {
echo $auth['user_email'];
} ?>">
<input type="text" name="user_login"
value="<?php echo isset( $auth['user_login'] ) ? $auth['user_login'] : "" ?>"
placeholder="<?php _e( 'Username', ET_DOMAIN ) ?>">
</div>
<?php
$role_default = ae_get_social_login_user_roles_default();
$social_user_roles = ae_get_option( 'social_user_role', false );
if ( ! $social_user_roles ) {
$social_user_roles = ae_get_social_login_user_roles_default();
}
if ( $social_user_roles && count( $social_user_roles ) >= 1 ) { ?>
<div class="fre-input-field">
<select name="user_role" id="user_role" class="fre-chosen-single">
<option selected disabled value=""><?php _e('Choose your role',ET_DOMAIN);?></option>
<?php foreach ( $social_user_roles as $key => $value ) { ?>
<option value="<?php echo $key ?>"><?php echo $role_default[ $value ]; ?></option>
<?php } ?>
</select>
</div>
<?php } ?>
<div class="fre-input-field">
<input type="submit" class="fre-submit-btn btn-submit" value="<?php _e( 'Sign Up', ET_DOMAIN ); ?>">
</div>
</form>
How to fix it my code in order to work ?