WordPress.org

Forums

User Meta Manager
[resolved] checkbox field: how to configure default 'off' (4 posts)

  1. ivarvd
    Member
    Posted 12 months ago #

    I have added a custom meta field.
    Field type is "Checkbox".
    When creating the field, I have the option to enter a Value.

    What it says with that option is: "The value you set will become the default value for all users."

    I want the default value of the checkbox field to be unchecked. So I don't enter a default value.

    Next I used the short code form builder to make a form with this field.

    But, when user checks the box and clicks 'Submit', this change is not saved.

    If I edit the custom meta field and enter something in the Value box (ie: "Yes"), then the form does work correctly. Unchecking and checking the box is saved when the form is submitted. But the problem with this is that by default the checkbox is checked instead of unchecked.

    My question is: how do I configure the custom meta field of type checkbox such that it is unchecked by default, and saves correctly when the form is submitted?

    It seems to me that in the setup there should be separate fields for:
    - 'Checked' value
    - Default value

    thanks
    Ivar

    https://wordpress.org/plugins/user-meta-manager/

  2. President McCheese
    Member
    Plugin Author

    Posted 12 months ago #

    Hi,

    This issue has been addressed in the latest version.

    The value you set for a field can work 2 ways -

    1) If the field is not a profile field, the value will become the default value for all new users.

    2) If the field is a profile field, the value becomes the profile field's value BEFORE it is changed and submitted by the new user.

    By default, checkboxes are not checked in the Add User and User Registration forms. However, the Pro plugin has the option to change the initial state of the checkbox for single checkboxes or checkbox groups.

    Only registered users can access User Meta Manager's short code forms, and those values are already set during registration.

    Let me know if you have any additional questions.

  3. ivarvd
    Member
    Posted 11 months ago #

    Thanks for your reply. But I don't get it.
    Using the 'Add custom meta' button I add a field, where I choose:
    Value: 1
    Field type: Checkbox
    Add to profile: Yes.

    So with these settings I assume the field is a 'profile field'.
    The value (set to '1') should now become the profile field's value before it's changed.
    Does this mean that if the checkbox is checked by the user, and the form is submitted, the value becomes '1'?
    Does this value get recognized as the value which corresponds to 'checked' when editing the profile again?

    You say that by default, checkboxes are not checked in the Add user form. But with the above settings, in the Add user form, the checkbox for this new custom meta field IS checked.

    That is a problem, because I don't want the checkbox to be checked initially.

    Will this problem be solved by using the Pro plugin?

  4. President McCheese
    Member
    Plugin Author

    Posted 11 months ago #

    Actually, I DID find an issue with the way I had it setup, which was the root of this problem. I made a few changes in version 3.3.2 that should finally resolve this.

    When Adding custom meta, you can now choose to update the value for all current users (or not).

    By default, checkboxes will not be checked in the Add User and User Registration forms. However, the Pro plugin allows you to change this behavior.

    Let me know if you have any additional questions.

Reply

You must log in to post.

About this Plugin

  • User Meta Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic