admin管理员组文章数量:1314488
I have created a new PHP file in the plugins folder and added the code:
function add_tml_registration_form_fields() {
tml_add_form_field( 'register', 'phone', array(
'type' => 'tel',
'label' => 'Mobile Number',
'value' => tml_get_request_value( 'phone', 'post' ),
'id' => 'phone',
'priority' => 15,) );
}
add_action( 'init', 'add_tml_registration_form_fields' );
function validate_tml_registration_form_fields( $errors ) {
if ( empty( $_POST['phone'] ) ) {
$errors->add( 'empty_phone', '<strong>ERROR</strong>: Please enter your mobile number.' );
}
add_filter( 'registration_errors', 'validate_tml_registration_form_fields' );
function save_tml_registration_form_fields( $user_id ) {
if ( isset( $_POST['phone'] ) ) {
update_user_meta( $user_id, 'phone', sanitize_text_field( $_POST['phone'] ) );
}
}
add_action( 'user_register', 'save_tml_registration_form_fields' );
But I am getting error. please refer to this image:
Please suggest some help.
本文标签: How to add Mobile field in Registration form using Theme my login Plugin
版权声明:本文标题:How to add Mobile field in Registration form using Theme my login Plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741968602a2407696.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论