Skip to content

Allow customization of downloads sort order #9763

@itsananderson

Description

@itsananderson

Enhancement Request

In the EDD User Downloads block, the downloads are sorted alphabetically by product name. It would be useful to be able to use a different sorting algorithm.

Explain your enhancement (please be detailed)

The downloads block seems to use a fixed ksort to order user downloads before rendering them.

Ideally it would be helpful if this order was configurable with a WordPress filter.

Justification or use case

While alphabetical ordering is reasonable for many use cases, it doesn't work for all cases. I sell a Bundle that includes items for each release of a digital product, and I use semver versioning for my release names. Unfortunately, when you sort semver versions alphabetically, you don't always get the correct ordering. For example:

Expected Ordering:

1.0.0
1.0.1
1.0.2
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.0.8
1.0.9
1.0.10

ksort Ordering:

1.0.0
1.0.1
1.0.10
1.0.2
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.0.8
1.0.9

Adding a WordPress filter for the download list would make it possible to choose a custom sorting algorithm. In addition to semver sorting, it would also be possible to sort by publish date or other properties of the download item details.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions