u3a-siteworks-development / u3a-siteworks-core

The core plugins
GNU General Public License v2.0
1 stars 0 forks source link

OP1065 WordPress quick edit shows "published" posts as "scheduled" #105

Closed nicktrosnant closed 1 month ago

nicktrosnant commented 1 month ago

Reported in this post on the forum.

In the quick edit panel, accessed from the dashboard post lists, all u3a custom post types are shown as Status "Scheduled" even when they are "Published". It's only in the quick edit panel that they are shown as "Scheduled". In all other places, including the wp_posts database table, they are shown as published. The "Published" option does not show in the Status drop-down.

Screenshot from 2024-07-31 12-11-16

AFAIK the only code that affects the Quick Edit component is the ModifyQuickEdit trait in the file inc/traits.php which inserts a bit of JavaScript to hide some standard elements in the Quick Edit.

edwery commented 1 month ago

Interestingly, removing of that filter from admin-head-edit makes the problem go away.

edwery commented 1 month ago

caused by this line: $('.inline-edit-date').each(function(i) { $(this).remove(); });

edwery commented 1 month ago

The select box holds four values Publish Scheduled, Pending Review and Draft.
With the above lines commented out, we see Publish, Pending Review and Draft - as well as the date/time controls. With the above lines present, we see Shceduled, Pending Review and Draft - with the date/time controls removed.

Truly odd.

edwery commented 1 month ago

So its something like this: If you remove the date edit boxes, something is assuming the event is in the future, and filtering out the 'published' entry, inserting the 'scheduled' entry. If you have the edit date boxes present, and the event is in the past , the list shows 'publish', but if you set the date to sometime in the future and save, the list then shows 'scheduled' instead.

edwery commented 1 month ago

Some bit of logic populating the possible statuses must be using the values culled from those fields, and removing them has upset it.

edwery commented 1 month ago

As a reasonable workround - shall we use hide() instead of remove()