wp downloadmanager: how to change the default sort order in the admin overview page

[posted: ]  [0 comments]

the problem:
WP DownloadManager, a very handy plugin for wordpress, sorts all downloads by name in ascending order on the admin overview page. i find this impractical, because i mainly open that page to (1) see how my downloads are doing in terms of clicks and (2) edit one of the most recent links.

the solution:
…is quite simple. just open the built-in wordpress plugin editor, choose the correct plugin to edit in the top right dropdown menu (“WP-DownloadManager”), click “choose” (or “wähle” in german), …

open the built-in wordpress plugin editor, choose the correct plugin to edit in the top right dropdown menu ("WP-DownloadManager"), click "choose" (or "wähle" in german),

… then click the 4. file in the rightside list (“…/download-manager.php” – make sure it’s not “/wp-download-manager.php”!), and find the code near “### Get Order By”.

then click the 4. file in the rightside list (".../download-manager.php" - make sure it's not "/wp-download-manager.php"!), and find the code near "### Get Order By".

at the end of that block, there’s a section “default:”, and this is where the fun happens.
as in the screenshots, turn the original $file_sortby and $file_sortby_text into comments using a double-slash “//”, and add your own desired values below (or edit the original lines directly).

to sort by “File ID”, make it look like this:
// $file_sortby = 'file_name';
// $file_sortby_text = __('File Name', 'wp-downloadmanager');
$file_sortby = 'file_id';
$file_sortby_text = __('File ID', 'wp-downloadmanager');

just below, there’s “### Get Sort Order”. in order to sort “descending”, change the code accordingly:
// $file_sortorder = 'ASC';
// $file_sortorder_text = __('Ascending', 'wp-downloadmanager');
$file_sortorder = 'DESC';
$file_sortorder_text = __('Descending', 'wp-downloadmanager');

don’t forget to save your changes using the “update file” (“datei aktualisieren”) button at the bottom.

now, when you open up “Manage Downloads” from the admin navigation, your downloads are sorted by File ID in descending order:

now, when you open up "Manage Downloads" from the admin navigation, your downloads are sorted by File ID in descending order

Be Sociable, Share!
    [category: computers & technology] [tags: , , ]

    Leave a Reply