buddypress-docs icon indicating copy to clipboard operation
buddypress-docs copied to clipboard

Recent docs widget not showing latest docs

Open ParkLai opened this issue 3 years ago • 4 comments

When placing the Recent Docs Widget on a page, it always shows the first 4 (or the number set in "number of docs to show" setting) documents sorted by ID, instead of published date. Therefore the widget will always show the same docs regardless of the new documents being uploaded.

ParkLai avatar Jun 16 '22 05:06 ParkLai

Hello @ParkLai - The widget sorts by 'modified', rather than publish date. Can you verify whether this is the behavior on your installation?

You might help to debug by checking the doc_query object here, which should be a WP_Query with 'orderby' => 'modified'.

boonebgorges avatar Jun 16 '22 21:06 boonebgorges

Hi @boonebgorges, think it sorts by ID, as it only shows the first few uploaded docs regardless of their modified date.

I'm looking at the file class-wp-widget-recent-docs.php, and tried adding the 'orderby' parameter to the $doc_args but still it doesn't seem to work.

Can you point me on which file and how should I check the doc_query object?

ParkLai avatar Jun 17 '22 05:06 ParkLai

Sorry, I meant to give you this link in the previous comment: https://github.com/boonebgorges/buddypress-docs/blob/d69ab86a2fe6c6f3a61dca6425bc60a9208c3949/includes/templatetags.php#L134=

$bp->bp_docs->doc_query should have the orderby query_var set to modified. My guess is that you have a plugin preventing this from happening.

boonebgorges avatar Jun 17 '22 11:06 boonebgorges

Yes, you're right. Seems like the orderby has been set to title instead of modified. Tried using the filter bp_docs_default_sort_order to set it, but not working. Will check and see what's causing this issue.

ParkLai avatar Jun 22 '22 04:06 ParkLai