Ticket #3595 (closed enhancement: fixed)

Opened 2 years ago

Last modified 1 year ago

Links and link categories not filtered by get_links_list

Reported by: jhodgdon Assigned to: rob1n
Priority: high Milestone: 2.3
Component: General Version: 2.0.7
Severity: normal Keywords: link, filter, has-patch
Cc: jhodgdon

Description

When you make a list of links (or blogroll) in your sidebar using the get_links_list function, neither the link category names nor the links themselves are run through a filter. It would be very helpful if they were filtered, so that plugins could modify the text displayed.

For instance, the Polyglot plugin filters regular category names, so you can make them bilingual. But link names and link categories are not filtered in the same way.

I suggest creating filters called: link_category, link_title, link_description

I will attach some patches to implement this...

Attachments

bookmark-template.php.diff (1.2 kB) - added by jhodgdon on 01/16/07 20:44:57.
Patch of wp-includes/bookmark-template.php to implement link and link category filtering
wp-links-opml.php.diff (1.4 kB) - added by jhodgdon on 01/16/07 21:57:44.
Diff file for wp-links-opml.php
link-manager.php.diff (1.9 kB) - added by jhodgdon on 01/16/07 23:06:09.
wp-admin/link-manager.php patch (see also ticket [3599 #3599]
link-import.php.diff (0.7 kB) - added by jhodgdon on 01/16/07 23:09:02.
patch for wp-admin/link-import.php
bookmark-template-php-2.diff (1.2 kB) - added by jhodgdon on 03/09/07 20:10:27.
Another patch for different function in bookmark-template.php
bookmark-template-php-NEW.diff (1.1 kB) - added by jhodgdon on 06/22/07 20:55:38.
New patch compatible with new term/category structure of 2.3 bleeding
bookmark-template-php-2-3.diff (2.0 kB) - added by jhodgdon on 08/30/07 02:10:04.
New patch using sanitize_bookmark_field function for 2.3
wp-links-opml-2-3.diff (0.6 kB) - added by jhodgdon on 09/01/07 15:06:28.
Replacement patch for wp-links-opml.php

Change History

01/16/07 20:44:57 changed by jhodgdon

  • attachment bookmark-template.php.diff added.

Patch of wp-includes/bookmark-template.php to implement link and link category filtering

01/16/07 21:57:44 changed by jhodgdon

  • attachment wp-links-opml.php.diff added.

Diff file for wp-links-opml.php

01/16/07 22:19:30 changed by jhodgdon

  • owner deleted.

01/16/07 22:21:48 changed by jhodgdon

  • owner set to jhodgdon.

See ticket [3599 #3599] for some additional information on the admin section's filtering of links.

01/16/07 22:21:58 changed by jhodgdon

  • owner deleted.

01/16/07 22:55:34 changed by ryan

Also needed in _walk_bookmarks().

01/16/07 23:06:09 changed by jhodgdon

  • attachment link-manager.php.diff added.

wp-admin/link-manager.php patch (see also ticket [3599 #3599]

01/16/07 23:09:02 changed by jhodgdon

  • attachment link-import.php.diff added.

patch for wp-admin/link-import.php

01/16/07 23:14:04 changed by jhodgdon

Ryan: send me email if you would like me to patch anything else... I am done with the patches I knew about needing, for the moment.

02/23/07 00:53:10 changed by jhodgdon

  • keywords changed from link, filter to link, filter, has-patch.

02/23/07 01:35:46 changed by ryan

  • owner set to ryan.

03/09/07 20:09:50 changed by jhodgdon

  • cc set to jhodgdon.

I just found another spot in bookmark-template.php that also needed patching in a similar way, for the wp_list_bookmarks function. Since this is still open, I'll just attach that patch here...

03/09/07 20:10:27 changed by jhodgdon

  • attachment bookmark-template-php-2.diff added.

Another patch for different function in bookmark-template.php

03/09/07 20:22:02 changed by jhodgdon

Ryan, I just realized your earlier comment about _walk_bookmarks is why wp_list_bookmarks was not working. Sorry about missing the earlier comment -- anyway this latest patch fixes _walk_bookmarks.

03/10/07 01:13:55 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [5011]) Link filters from jhodgdon. fixes #3595

06/01/07 17:40:04 changed by jhodgdon

  • status changed from closed to reopened.
  • resolution deleted.

I am reopening this bug because the first patch above to bookmarks-template.php didn't ever get applied. Could it be? Thanks!

Verified it is not applied in [5560]; also not applied in 2.2.

06/01/07 20:06:40 changed by rob1n

  • owner changed from ryan to rob1n.
  • status changed from reopened to new.

06/01/07 22:56:25 changed by rob1n

  • milestone changed from 2.2 to 2.3.

06/22/07 20:55:38 changed by jhodgdon

  • attachment bookmark-template-php-NEW.diff added.

New patch compatible with new term/category structure of 2.3 bleeding

06/22/07 20:58:36 changed by jhodgdon

I just added a new patch, which works on [5744], called bookmark-template-php-NEW.diff.

Don't apply it to the 2.2 branch, of course! For that branch, the patch above called "bookmark-template.php.diff" would be better.

08/30/07 02:09:26 changed by jhodgdon

I have a new patch that uses the sanitize_bookmark function instead of directly using apply_filters, as requested by rboren during the bug hunt. Attaching momentarily...

08/30/07 02:10:04 changed by jhodgdon

  • attachment bookmark-template-php-2-3.diff added.

New patch using sanitize_bookmark_field function for 2.3

09/01/07 15:06:01 changed by jhodgdon

In [6002], the admin screens are now fine, but the sidebar function get_links_list is still broken. The bookmark-template-php-2-3.diff patch (above) fixes that.

A related problem that was patched above is that if you visit (blogurl)/wp-links-opml.php (to make an OPML dump of your blogroll), the title element is unfiltered (this is the blog title). The patch that was there for wp-links-opml.php is not updated for the new functions in 2.3, so I'll make a new one.

The other patch that was there for the link import screen is not needed, as that problem was fixed in another patch.

09/01/07 15:06:28 changed by jhodgdon

  • attachment wp-links-opml-2-3.diff added.

Replacement patch for wp-links-opml.php

09/01/07 15:11:38 changed by jhodgdon

So I suggest applying just these two patches:

bookmark-template-php-2-3.diff

wp-links-opml-2-3.diff

By the way, where does that $cat_name in wp-links-opml.php come from (right after get_bloginfo('name') in the patched line? It should probably be omitted? I tried visiting

(blogurl)/wp-links-opml.php?cat=1

(which is my default link category) and it didn't put anything in the output for $cat_name, so I think it's never being defined. Not sure what it was intended to do -- maybe it was from a previous version and didn't get deleted? If it is intended to print a category name, then probably it should be fixed so it actually does.

09/13/07 21:19:20 changed by ryan

  • priority changed from normal to high.

09/23/07 19:25:16 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [6160]) Add some filtering. Props jhodgdon. fixes #3595