"Add to Hyve" row action appears on all non-hierarchical post types (e.g. Otter Form Submissions) but does nothing there

Đang mở Phù hợp với người mới
#326 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
79/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, wordpress
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với Main::register_row_action_filter_shortcut() và add_to_knowledge_base_row_action(); theo dõi cách các hook post_row_actions và page_row_actions ảnh hưởng đến các loại bài viết khác. Kiểm tra enqueue_addons_assets() để hiểu khi nào script của thao tác trên hàng được tải. Hoàn thành khi các loại bài viết không được hỗ trợ không còn hiển thị thao tác này và các thao tác cho Bài viết và Trang vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description
With the "Add to Hyve" post row action enabled, the link shows up on list screens it doesn't support, such as Otter's Form Submissions (edit.php?post_type=otter_form_record). Clicking it does nothing: no request is sent and no error is shown.

Environment

  • Hyve Lite 2.0.5, Hyve Pro 2.0.4
  • Otter Blocks / Otter Pro 3.2.14

Steps to reproduce

  1. Enable the post row action in Hyve settings (post_row_addon_enabled).
  2. Submit an Otter form so at least one record exists.
  3. Go to Otter → Form Submissions (/wp-admin/edit.php?post_type=otter_form_record).
  4. Hover over a submission and click Add to Hyve.
image

Expected: The link isn't shown on unsupported post types (or, if those types are meant to be supported, it works).
Actual: The link is shown and does nothing. build/addons/index.js and hyveAddons aren't loaded on this screen, so no handler is attached to .hyve-row-action-btn. On Posts (edit.php) the script loads and the action works.

Root cause
Main::register_row_action_filter_shortcut() builds the hook name as $post_type . '_row_actions':

  • For post that gives post_row_actions, which WordPress runs for every non-hierarchical post type.
  • For page that gives page_row_actions, which runs for every hierarchical post type.

But enqueue_addons_assets() only loads the script when hyve_register_row_action_for_{$screen->post_type} is true, and that's only set for post and page. The button ends up on every list table, but the JS only loads for two of them.

Suggested fix
In add_to_knowledge_base_row_action(), return $actions unchanged unless apply_filters( 'hyve_register_row_action_for_' . $post->post_type, false ) is true. That keeps the button and the script loader in sync. It also stops third-party post types like form submissions or orders from being offered for the Knowledge Base, which probably shouldn't happen without an opt-in anyway.


Generated by Claude Code

Ngôn ngữ chính
PHP
Star
1
Fork
2
Merge trung bình
3 ngày 8 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Codeinwp/hyve-lite

Tất cả issue của Codeinwp/hyve-lite

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.