Opened 3 years ago

Last modified 20 months ago

#14960 accepted enhancement

Add More bulk actions to the link manager

Reported by: teraom Owned by: edwardw
Priority: low Milestone: Future Release
Component: General Version:
Severity: normal Keywords: has-patch dev-feedback
Cc:

Description

Currently, the link manager supports only one bulk action, which is delete.
If there are a lot of links, making links visible and invisible is now a tedious process. A bulk action for "make visible" and "make hidden" would be a good enhancement, IMHO.

Attachments (2)

patch14960.diff (3.4 KB) - added by edwardw 22 months ago.
[PATCH] Add features to bulk show/hide links
patch14960_v2.diff (4.3 KB) - added by edwardw 20 months ago.
[PATCH] Add features to bulk show/hide links

Download all attachments as: .zip

Change History (8)

  • Milestone changed from Awaiting Review to Future Release

An even better enhancement would be to transform links into a custom post type.

That said, it's pretty easy for plugins to add additional bulk actions in WP 3.1.

[PATCH] Add features to bulk show/hide links

  • Keywords has-patch dev-feedback added
  • Owner set to edwardw
  • Status changed from new to accepted
  • Version 3.1 deleted
  • Keywords links link manager removed
  • Keywords needs-refresh added; dev-feedback removed
  • Priority changed from normal to low

This patch seems like a good first step.

Coding standards:

  • Needs more spaces, especially in wp-admin/link.php and in link-manager.php.
  • Use single quotes rather than double quotes when able, in the list table code.
  • In link-manager.php, convert the $doaction if/elseif/elseif to a switch with breaks.

Code itself:

  • Use esc_url( wp_nonce_url( admin_url() ) ), rather than wp_nonce_url() and &. esc_url() will do that conversion for you, and further, wp_nonce_url() will reverse & anyway, so it's ending up unescaped in the existing patch.
  • Namespace the nonces. Rather than show_$id, hide_$id, consider show-bookmark_$id and hide-bookmark_$id.
  • Only add $actionsshow? if 'N' == $link->link_visible, and only add $actionshide? if Y' == $link->link_visible. (Note this is not a simple if/else construct, but rather if/elseif, as I think a plugin could override link_visible to be another value. So better to be specific that these actions only work for the boolean values.)

Translations:

  • Translators will probably want these links to be contextualized. So _x( 'Show', 'link' ), and _x( 'Hide', 'link' ). We don't seem to be very good at contextualizing action links here and elsewhere though, so you can skip this step.

Ultimately, links are such a little-used feature that this patch will never be a priority. But once we branch off 3.3 and trunk becomes 3.4, if someone drops a comment I will come by and handle. (Assuming the patch is updated.)

[PATCH] Add features to bulk show/hide links

  • Keywords dev-feedback added; needs-refresh removed

Updated as per suggestions - thanks nacin.

Note: See TracTickets for help on using tickets.