Open Jzsiba opened 9 months ago
I've fixed the invalid ajax error issue. Here is my pods package export
{ "@meta": { "version": "3.0.4", "build": 1695971772 }, "settings": { "types_only": "0", "watch_changed_fields": "0", "metadata_integration": "1", "metadata_override_get": "0", "media_modal_fields": "0", "session_auto_start": "0", "wisdom_opt_out": "1", "active_components": [ "migrate-packages", "roles-and-capabilities", "templates" ] }, "pods": [ { "name": "chapter", "id": 16, "label": "Chapters", "description": "", "type": "post_type", "storage": "meta", "label_singular": "Chapter", "public": "1", "show_ui": "1", "rest_enable": "1", "supports_title": "1", "supports_editor": "1", "_migrated_28": "1", "show_in_menu": "1", "menu_position": "0", "show_in_nav_menus": "1", "show_in_admin_bar": "1", "default_status": "publish", "pick_object": "custom-simple", "required": "0", "supports_comments": "1", "groups": [ { "name": "more_fields", "id": 17, "label": "More Fields", "description": "", "weight": 0, "fields": [ { "name": "post_as", "id": 18, "label": "Post As", "description": "Select your character", "weight": 0, "type": "pick", "pick_object": "post_type", "pick_val": "character", "sister_id": "-- Select One --", "pick_table": "-- Select One --", "required": "1", "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": "0", "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": "1", "repeatable": "0", "repeatable_format": "default", "roles_allowed": "administrator", "enable_conditional_logic": "0", "rest_pick_response": "array", "rest_pick_depth": "1", "pick_display": "{@post_title}" } ] } ] }, { "name": "character", "id": 5, "label": "Characters", "description": "", "type": "post_type", "storage": "meta", "label_singular": "Character", "public": "1", "show_ui": "1", "rest_enable": "1", "supports_title": "1", "supports_editor": "1", "_migrated_28": "1", "default_status": "publish", "can_export": "1", "show_in_nav_menus": "1", "show_in_admin_bar": "0", "delete_with_user": "1", "pick_object": "custom-simple", "required": "0", "groups": [ { "name": "more_fields", "id": 6, "label": "More Fields", "description": "", "weight": 0, "fields": [ { "name": "avatar", "id": 10, "label": "Avatar", "description": "Avatar", "weight": 0, "type": "file", "sister_id": "-- Select One --", "required": "0", "file_format_type": "single", "file_uploader": "attachment", "file_type": "images", "file_attachment_tab": "upload", "file_upload_dir": "wp", "file_edit_title": "1", "file_show_edit_link": "1", "file_linked": "1", "file_limit": "0", "file_field_template": "rows", "file_add_button": "Add Avatar", "file_modal_title": "Attach an Avatar", "file_modal_add_button": "Add Avatar", "file_wp_gallery_link": "file", "file_wp_gallery_columns": "3", "file_wp_gallery_size": "thumbnail", "repeatable": "0", "repeatable_format": "default", "roles_allowed": "administrator", "enable_conditional_logic": "0", "rest_pick_response": "array", "rest_pick_depth": "1", "class": "char_avatar" }, { "name": "age", "id": 7, "label": "Age", "description": "How old is this character?", "weight": 1, "type": "number", "sister_id": "-- Select One --", "required": "0", "number_format_type": "number", "number_format": "i18n", "number_decimals": "0", "number_format_soft": "0", "number_step": "1", "number_max_length": "12", "number_html5": "1", "repeatable": "0", "repeatable_format": "default", "roles_allowed": "administrator", "enable_conditional_logic": "0", "rest_pick_response": "array", "rest_pick_depth": "1" } ] } ] }, { "name": "comment", "id": 24, "label": "Comment", "description": "", "type": "comment", "storage": "meta", "object": "comment", "_migrated_28": "1", "pick_object": "custom-simple", "required": "0", "pfat_enable": "1", "pfat_archive": "Generic Comments Template", "pfat_filter_archive": "comment_text", "pfat_append_archive": "replace", "groups": [ { "name": "more_fields", "id": 25, "label": "More Fields", "description": "", "weight": 0, "fields": [ { "name": "post_as", "id": 26, "label": "Post As", "description": "Select your character", "weight": 0, "type": "pick", "pick_object": "post_type", "pick_val": "character", "sister_id": "-- Select One --", "pick_table": "-- Select One --", "required": "1", "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": "0", "pick_taggable": "0", "pick_show_icon": "1", "pick_show_edit_link": "0", "pick_show_view_link": "0", "pick_limit": "0", "pick_user_role": "Administrator", "pick_post_status": "publish", "pick_post_author": "1", "repeatable": "0", "repeatable_format": "default", "roles_allowed": "administrator", "enable_conditional_logic": "0", "pick_display": "{@post_title}", "conditional_logic": { "action": "show", "logic": "any", "rules": [ { "field": "post_as", "compare": "=", "value": "" } ] }, "class": "post_as_dropdown", "logged_in_only": "1" } ] } ] }, { "name": "post", "id": 31, "label": "Posts", "description": "", "type": "post_type", "storage": "meta", "object": "post", "_migrated_28": "1", "pick_object": "custom-simple", "required": "0", "pfat_enable": "1", "pfat_filter_single": "the_content", "pfat_filter_archive": "the_excerpt", "pfat_run_outside_loop": "0", "pfat_single": "Generic Post Template", "pfat_append_single": "replace", "groups": [ { "name": "more_fields", "id": 32, "label": "More Fields", "description": "", "weight": 0, "fields": [ { "name": "selected_char", "id": 33, "label": "Post As", "description": "Select your character", "weight": 0, "type": "pick", "pick_object": "post_type", "pick_val": "character", "sister_id": "-- Select One --", "pick_table": "-- Select One --", "required": "1", "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": "0", "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": "1", "repeatable": "0", "repeatable_format": "default", "roles_allowed": "administrator", "enable_conditional_logic": "0", "rest_pick_response": "array", "rest_pick_depth": "1", "pick_display": "{@post_title}" } ] } ] } ], "templates": [ { "name": "Generic Comments Template", "code": "<h1>Comment By:{@post_as.post_title}<\/h1>\r\n<hr \/>\r\nBody: {@comment_content}", "id": 42, "_edit_lock": "1695967755:1", "_edit_last": "1", "_wpb_vc_js_status": "false", "pod_reference": { "pod": "comment" }, "admin_only": "0", "restrict_capability": "0", "show_restrict_message": "0", "_pods_capability_allowed": [ "" ] }, { "name": "Generic Post Template", "code": "<h1>Title:{@post_title}<\/h1>\r\n<p><strong>Posted By:{@selected_char.post_title}<\/strong><\/p>\r\n<hr \/>\r\nBody: {@post_content}", "id": 37, "_edit_lock": "1695970188:1", "_edit_last": "1", "_wpb_vc_js_status": "false", "admin_only": "0", "restrict_capability": "0", "show_restrict_message": "0", "_pods_capability_allowed": [ "" ], "pod_reference": { "pod": "post" } } ] }
Details about how this field option works --
Option label:
Limit list to the same Post Author
Option help text:
You can choose to limit Posts available for selection to those created by the same Post Author. This only works if this pod is a Post Type and this field is related to a Post Type.
So it's not really designed for post types, however, it's possible we could add support for comment authors here in the future.
That would be most excellent, my workaround does exactly the same thing it's just a seemingly unnecessary extra step.
I do understand why it's acting the way it is, because the comment field doesn't live within a standard posting interface where Pods knows that the person looking at the "new post" interface, is the author of the post, and thus, can tell the dropdown what it should be doing. So my workaround simply uses the logged in users ID.
EDIT: Just to clarify, the dropdown field I added, via pods, to the Comments post type, is supposed to be agnostic to the post being commented on.
Description
Toggling on "Limit list to the same Post Author" works for every other post type I've tried, including the default "posts" post type. But it does not work for Comments. The dropdown is not filtered by posts by the logged in user.
Version
3.0.4
Testing Instructions
Go to an existing post that has comments enabled and find the Comments form at the bottom of the post. See your dropdown, and get somewhat disappointed by the fact that it will list every post created in the custom post type you selected in step 7 instead of the posts created by the user who is currently logged in and attempted to post a comment.
Screenshots / Screencast
Relationship checkbox.
My dropdown illustrating posts that are mine, vs the ones that aren't.
Possible Workaround
WHERE Clause matching author of custom post type to current user logged in ID.
post_author.ID = {@user.ID}
Site Health Information
Pods Package