h5p / h5p-wordpress-plugin

Adds support for H5P Content in WordPress.
https://wordpress.org/plugins/h5p/
70 stars 75 forks source link

Sorting by Author in "All H5P Content" Fails with Error in Version 1.15.6 #166

Closed malimart closed 9 months ago

malimart commented 9 months ago

Description:

I am experiencing a bug with the h5p-wordpress-plugin (version 1.15.6) regarding the sorting functionality in the "All H5P Content" section. Specifically, the sorting feature by "Author" fails and results in an error message.

Steps to Reproduce:

  1. Navigate to the "All H5P Content" section in the WordPress admin dashboard.
  2. Attempt to sort the list of H5P content by "Author" using the provided sorting options.

Expected Behavior:

The list of H5P content should be sorted by the author's name without issues.

Actual Behavior:

When attempting to sort by "Author," an error message is displayed: "Failed to load data." This issue seems to be specific to version 1.15.6 of the plugin, as it does not occur in version 1.15.4.

Environment:

Workaround:

Reverting to version 1.15.4 of the h5p-wordpress-plugin resolves the issue, indicating that the bug was introduced in version 1.15.6 or 1.15.5.

Additional Information:

Screenshot of the error:

h5p_author_sort

otacke commented 9 months ago

Caused by https://github.com/h5p/h5p-wordpress-plugin/pull/133

malimart commented 9 months ago

I have tested the fix (#167) for sorting content by author. While the update has indeed enabled sorting by author on individual pages, I've observed a limitation that I believe warrants further attention.

The current implementation of the sorting feature by author appears to work correctly on a per-page basis. However, when the content spans multiple pages (e.g., when viewing 20 items per page), the sorting does not seem to consider items across all pages. It only sorts the items that are visible on the current page.

Sorting by other properties like Title and ID functions as expected, providing a consistent sorting order across all the content on all pages.

otacke commented 9 months ago

That observation is certainly correct.

otacke commented 9 months ago

Moved limiting the results from database query to PHP when ordering by user field https://github.com/h5p/h5p-wordpress-plugin/pull/167/commits/4ebd2e6053eef57df12b0c9ce5dfedff65946bf0