pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.06k stars 265 forks source link

Field with Simple Relationship fails to correctly update if Default Select Text is set #7241

Open HmCody opened 6 months ago

HmCody commented 6 months ago

Description

I have a Pod called "membership" that has a Simple Relationship field called "member_type." Possible values are "Family" and "Individual". Default Select Text was set to "Individual", as was Default Value. When I updated a membership which had member_type set to "Individual", member_type was resetting to empty. Memberships with member_type set to "Family" were working as expected. This was happening both on my local test site and on the production site.

First I tried disabling all of my other plugins and that made no difference.

I then tried changing the field settings to remove Individual from Default Select Text, and member_type began to update correctly again. I also tried creating the same dropdown on another Pod which worked the same way. It updated correctly if Default Select Text was not set, and failed if it was.

Version

3.0.10

Testing Instructions

No response

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

No response

Pods Package

This shows both the updated membership Pod (Default Select Text="" which is now working) and the title_test Pod (Default Select Text="Individual" in which the field update is failing).

{
    "@meta": {
        "version": "3.0.10",
        "build": 1703508363
    },
    "settings": {
        "session_auto_start": "0",
        "wisdom_opt_out": "1",
        "types_only": "0",
        "watch_changed_fields": "1",
        "metadata_integration": "1",
        "metadata_override_get": "1",
        "media_modal_fields": "1",
        "active_components": [
            "migrate-packages",
            "templates"
        ]
    },
    "pods": [
        {
            "name": "membership",
            "id": 618,
            "label": "Memberships",
            "description": "",
            "label_singular": "Membership",
            "public": "1",
            "show_ui": "1",
            "supports_title": "1",
            "supports_editor": "0",
            "type": "post_type",
            "storage": "meta",
            "publicly_queryable": "1",
            "exclude_from_search": "0",
            "capability_type": "custom",
            "capability_type_custom": "membership",
            "capability_type_extra": "1",
            "has_archive": "1",
            "hierarchical": "0",
            "rewrite": "1",
            "rewrite_with_front": "1",
            "rewrite_feeds": "0",
            "rewrite_pages": "1",
            "query_var": "1",
            "can_export": "1",
            "default_status": "publish",
            "supports_author": "0",
            "supports_thumbnail": "0",
            "supports_excerpt": "0",
            "supports_trackbacks": "0",
            "supports_custom_fields": "0",
            "supports_comments": "0",
            "supports_revisions": "0",
            "supports_page_attributes": "0",
            "supports_post_formats": "0",
            "built_in_taxonomies_category": "0",
            "built_in_taxonomies_link_category": "0",
            "built_in_taxonomies_post_tag": "0",
            "show_in_menu": "1",
            "show_in_nav_menus": "1",
            "show_in_admin_bar": "1",
            "pfat_enable": "1",
            "pfat_run_outside_loop": "0",
            "pfat_append_single": "append",
            "pfat_filter_single": "the_content",
            "pfat_append_archive": "append",
            "pfat_filter_archive": "custom",
            "rest_enable": "0",
            "read_all": "0",
            "write_all": "0",
            "pfat_single": "Member Directory",
            "menu_icon": "dashicons-groups",
            "label_all_items": "Memberships",
            "menu_position": "0",
            "built_in_taxonomies_event_year": "0",
            "built_in_taxonomies_media_category": "0",
            "built_in_taxonomies_wp_theme": "0",
            "pfat_filter_archive_custom": "the_content",
            "_migrated_28": "1",
            "revisions_to_keep_limit": "0",
            "delete_with_user": "1",
            "pick_object": "custom-simple",
            "required": "0",
            "menu_location_custom": "crfcrc-data",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 7987,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "storage_type": "post_type",
                    "fields": [
                        {
                            "name": "member_name",
                            "id": 627,
                            "label": "Member Name",
                            "description": "",
                            "weight": 0,
                            "type": "text",
                            "required": "1",
                            "text_allow_shortcode": "0",
                            "text_allow_html": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "text_repeatable": "0",
                            "text_placeholder": "First Names, then Last Name(s)"
                        },
                        {
                            "name": "salutation",
                            "id": 628,
                            "label": "Salutation",
                            "description": "",
                            "weight": 1,
                            "type": "text",
                            "required": "0",
                            "text_allow_shortcode": "0",
                            "text_allow_html": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "text_repeatable": "0",
                            "text_placeholder": "Just First Name(s)"
                        },
                        {
                            "name": "address",
                            "id": 629,
                            "label": "Address",
                            "description": "",
                            "weight": 2,
                            "type": "paragraph",
                            "required": "0",
                            "paragraph_allow_html": "0",
                            "paragraph_oembed": "0",
                            "paragraph_wptexturize": "1",
                            "paragraph_convert_chars": "1",
                            "paragraph_wpautop": "1",
                            "paragraph_allow_shortcode": "0",
                            "paragraph_allowed_html_tags": "strong em a ul ol li b i",
                            "paragraph_max_length": "0",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "paragraph_repeatable": "0"
                        },
                        {
                            "name": "city",
                            "id": 630,
                            "label": "City",
                            "description": "",
                            "weight": 3,
                            "type": "text",
                            "required": "0",
                            "text_allow_shortcode": "0",
                            "text_allow_html": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "text_repeatable": "0"
                        },
                        {
                            "name": "state",
                            "id": 631,
                            "label": "State",
                            "description": "",
                            "weight": 4,
                            "type": "text",
                            "required": "0",
                            "text_allow_shortcode": "0",
                            "text_allow_html": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "text_repeatable": "0"
                        },
                        {
                            "name": "postal_code",
                            "id": 632,
                            "label": "Postal Code",
                            "description": "",
                            "weight": 5,
                            "type": "text",
                            "required": "0",
                            "text_allow_shortcode": "0",
                            "text_allow_html": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "text_repeatable": "0"
                        },
                        {
                            "name": "country",
                            "id": 633,
                            "label": "Country",
                            "description": "",
                            "weight": 6,
                            "type": "text",
                            "required": "0",
                            "text_allow_shortcode": "0",
                            "text_allow_html": "0",
                            "text_allowed_html_tags": "strong em a ul ol li b i",
                            "text_max_length": "255",
                            "default_value": "USA",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "text_repeatable": "0"
                        },
                        {
                            "name": "contact_phone",
                            "id": 634,
                            "label": "Contact Phone",
                            "description": "",
                            "weight": 7,
                            "type": "phone",
                            "required": "0",
                            "phone_format": "(999) 999-9999 x999",
                            "phone_enable_phone_extension": "0",
                            "phone_max_length": "25",
                            "phone_html5": "0",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "phone_repeatable": "0"
                        },
                        {
                            "name": "member_type",
                            "id": 635,
                            "label": "Member Type",
                            "description": "Value MUST be either Individual or Family",
                            "weight": 8,
                            "type": "pick",
                            "required": "0",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "checkbox",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_post_status": [
                                "publish"
                            ],
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "default_value": "Individual",
                            "pick_object": "custom-simple",
                            "pick_custom": "Family|Family\nIndividual|Individual",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "sister_id": "-- Select One --",
                            "pick_table": "-- Select One --",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "enable_conditional_logic": "0"
                        },
                        {
                            "name": "dues_year",
                            "id": 636,
                            "label": "Dues Year",
                            "description": "Next Year after Oct 1, Current Year otherwise",
                            "weight": 9,
                            "type": "number",
                            "required": "0",
                            "number_format_type": "number",
                            "number_format": "9999.99",
                            "number_decimals": "0",
                            "number_format_soft": "0",
                            "number_step": "1",
                            "number_min": "0",
                            "number_max": "100",
                            "number_max_length": "4",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "number_repeatable": "0",
                            "default_value": "{@globals.crfcrc_dues_year}"
                        },
                        {
                            "name": "date_added",
                            "id": 637,
                            "label": "Date Added",
                            "description": "",
                            "weight": 10,
                            "type": "date",
                            "required": "0",
                            "date_type": "format",
                            "date_format": "mdy",
                            "date_allow_empty": "0",
                            "date_html5": "1",
                            "default_value": "{@date.m\/d\/Y}",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "date_repeatable": "0"
                        },
                        {
                            "name": "date_joined",
                            "id": 638,
                            "label": "Date Joined",
                            "description": "",
                            "weight": 11,
                            "type": "date",
                            "required": "0",
                            "date_type": "format",
                            "date_format": "mdy",
                            "date_allow_empty": "1",
                            "date_html5": "0",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "date_repeatable": "0",
                            "default_value": "{@date.m\/d\/Y}"
                        },
                        {
                            "name": "date_last_paid",
                            "id": 640,
                            "label": "Date Last Paid",
                            "description": "",
                            "weight": 12,
                            "type": "date",
                            "required": "0",
                            "date_type": "format",
                            "date_format": "mdy",
                            "date_allow_empty": "1",
                            "date_html5": "0",
                            "default_value": "{@date.m\/d\/Y}",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "date_repeatable": "0"
                        },
                        {
                            "name": "email_only_newsletter",
                            "id": 641,
                            "label": "email Only Newsletter",
                            "description": "",
                            "weight": 13,
                            "type": "boolean",
                            "required": "0",
                            "boolean_format_type": "checkbox",
                            "boolean_yes_label": "Yes",
                            "boolean_no_label": "No",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "default_value": "1"
                        },
                        {
                            "name": "donation",
                            "id": 642,
                            "label": "Donation",
                            "description": "",
                            "weight": 14,
                            "type": "currency",
                            "required": "0",
                            "currency_format_type": "number",
                            "currency_format_sign": "usd",
                            "currency_format_placement": "before",
                            "currency_format": "i18n",
                            "currency_decimals": "2",
                            "currency_decimal_handling": "none",
                            "currency_step": "1",
                            "currency_min": "0",
                            "currency_max": "1000",
                            "currency_max_length": "12",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "currency_repeatable": "0"
                        },
                        {
                            "name": "exclude_from_directory",
                            "id": 643,
                            "label": "Exclude from Directory",
                            "description": "",
                            "weight": 15,
                            "type": "boolean",
                            "required": "0",
                            "boolean_format_type": "checkbox",
                            "boolean_yes_label": "Yes",
                            "boolean_no_label": "No",
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0"
                        },
                        {
                            "name": "membership_to_user",
                            "id": 644,
                            "label": "Membership to User",
                            "description": "",
                            "weight": 16,
                            "type": "pick",
                            "pick_object": "user",
                            "required": "0",
                            "pick_format_type": "multi",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_allow_add_new": "0",
                            "pick_taggable": "0",
                            "pick_show_icon": "0",
                            "pick_show_edit_link": "0",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": [
                                "member",
                                "membera",
                                "memberm",
                                "membern",
                                "memberr",
                                "membersecretary",
                                "memberadmin",
                                "membersunshine",
                                "memberfield"
                            ],
                            "pick_post_status": [
                                "publish"
                            ],
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "sister_id": "645",
                            "unique": "0",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_display": "{@display_name}"
                        },
                        {
                            "name": "membership_to_dogs",
                            "id": 872,
                            "label": "Membership to Dogs",
                            "description": "",
                            "weight": 17,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "dog",
                            "sister_id": "871",
                            "required": "0",
                            "pick_format_type": "multi",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "autocomplete",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_post_status": [
                                "publish"
                            ],
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "unique": "0",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", "
                        },
                        {
                            "name": "membership_to_brags",
                            "id": 1020,
                            "label": "Membership to Brags",
                            "description": "",
                            "weight": 18,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "brag",
                            "required": "0",
                            "pick_format_type": "multi",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "autocomplete",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_post_status": [
                                "publish"
                            ],
                            "admin_only": "0",
                            "restrict_role": "0",
                            "restrict_capability": "0",
                            "hidden": "0",
                            "read_only": "0",
                            "roles_allowed": [
                                "administrator"
                            ],
                            "rest_read": "0",
                            "rest_write": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "2",
                            "sister_id": "1021",
                            "unique": "0",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", "
                        }
                    ]
                }
            ]
        },
        {
            "name": "title_test",
            "id": 8064,
            "label": "Title Tests",
            "description": "",
            "type": "post_type",
            "storage": "meta",
            "label_singular": "Title Test",
            "public": "1",
            "show_ui": "1",
            "rest_enable": "1",
            "supports_title": "1",
            "supports_editor": "1",
            "_migrated_28": "1",
            "required": "0",
            "groups": [
                {
                    "name": "more_fields",
                    "id": 8065,
                    "label": "More Fields",
                    "description": "",
                    "weight": 0,
                    "fields": [
                        {
                            "name": "akc_title",
                            "id": 8066,
                            "label": "AKC Title",
                            "description": "",
                            "weight": 0,
                            "type": "pick",
                            "pick_object": "post_type",
                            "pick_val": "akc_title",
                            "sister_id": "-- Select One --",
                            "post_status": "publish",
                            "pick_table": "-- Select One --",
                            "required": "0",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "checkbox",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "roles_allowed": "administrator",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1"
                        },
                        {
                            "name": "dropdown_test",
                            "id": 9853,
                            "label": "Dropdown Test",
                            "description": "",
                            "weight": 1,
                            "type": "pick",
                            "pick_object": "custom-simple",
                            "sister_id": "-- Select One --",
                            "pick_table": "-- Select One --",
                            "required": "0",
                            "pick_format_type": "single",
                            "pick_format_single": "dropdown",
                            "pick_format_multi": "list",
                            "pick_display_format_multi": "default",
                            "pick_display_format_separator": ", ",
                            "pick_allow_add_new": "1",
                            "pick_taggable": "0",
                            "pick_show_icon": "1",
                            "pick_show_edit_link": "1",
                            "pick_show_view_link": "1",
                            "pick_limit": "0",
                            "pick_user_role": "Administrator",
                            "pick_post_status": "publish",
                            "pick_post_author": "0",
                            "repeatable": "0",
                            "repeatable_format": "default",
                            "roles_allowed": "administrator",
                            "enable_conditional_logic": "0",
                            "rest_pick_response": "array",
                            "rest_pick_depth": "1",
                            "pick_custom": "Family|Family\nIndividual|Individual",
                            "pick_select_text": "Individual"
                        }
                    ]
                }
            ]
        }
    ]
}