Home › Forums › Plugin Support › Checkbox to confirm information when updating profile
Tagged: checkbox, confirmation, profile update
- This topic has 6 replies, 3 voices, and was last updated 10 years ago by
Khaled.
-
AuthorPosts
-
May 20, 2016 at 9:33 pm #7813May 21, 2016 at 4:11 pm #7822
Khaled
MemberHello Lena,
To do so, please use our current dev version and put following codes to your functions.php
Don’t forget to replace XYZ with your original field id.add_filter('user_meta_field_config_render', 'emptyTheCheckbox', 10, 3); function emptyTheCheckbox($field, $fieldID, $formName) { if ($fieldID == 'XYZ') $field['field_value'] = ''; return $field; }Thanks.
May 23, 2016 at 9:28 pm #7845Lena Lumelsky
MemberHello Khaled,
Thank you for your quick response. I put the code in my child theme’s functions.php file but it doesn’t seem to have resolved the issue. The checkbox remains checked when I go to edit an account.
We are using version 1.1.7.1 of the plugin and I put the proper field id# in the field id variable ($fieldID == ’88’)
Was there anything else I was supposed to change from your code other than the field id#? Wondering what I am missing?
May 23, 2016 at 10:21 pm #7847Khaled
MemberHi Lena,
With version 1.1.7.1, it shall not work. You will need to use dev version for that.
Thanks.
May 23, 2016 at 11:07 pm #7848deniscgn
MemberHello everybody,
isnt it easier to use user_meta_after_user_register & user_meta_after_user_update?
function reset_checkbox( $userData ) { $userData[ 'checkboxField' ] = ''; } add_action( 'user_meta_after_user_update', 'reset_checkbox' ); add_action( 'use user_meta_after_user_register', 'reset_checkbox' );I would do it this way.
May 24, 2016 at 1:54 pm #7849Lena Lumelsky
MemberThanks Khaled! Can you provide instructions on how to switch to the dev version? I didn’t see a download link. Will switching delete the current setup that I have now? The form has already gone live so it’s imperative that nothing gets lost in the transition.
May 29, 2016 at 10:03 pm #7855Khaled
MemberHi Lina,
You can use following codes in your current version. Thanks @Denis.
function resetCheckbox( $userData ) { delete_user_meta( $userData->ID, 'checkboxMetaKey' ); } add_action( 'user_meta_after_user_update', 'resetCheckbox' ); add_action( 'use user_meta_after_user_register', 'resetCheckbox' );Replace checkboxMetaKey with proper one.
Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.
