Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#3595 closed enhancement (fixed)

Links and link categories not filtered by get_links_list

Reported by: jhodgdon's profile jhodgdon Owned by: rob1n's profile rob1n
Milestone: 2.3 Priority: high
Severity: normal Version: 2.0.7
Component: General Keywords: link, filter, has-patch
Focuses: Cc:

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 (8)

bookmark-template.php.diff (1.2 KB) - added by jhodgdon 18 years ago.
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 18 years ago.
Diff file for wp-links-opml.php
link-manager.php.diff (1.9 KB) - added by jhodgdon 18 years ago.
wp-admin/link-manager.php patch (see also ticket [3599 #3599]
link-import.php.diff (668 bytes) - added by jhodgdon 18 years ago.
patch for wp-admin/link-import.php
bookmark-template-php-2.diff (1.2 KB) - added by jhodgdon 18 years ago.
Another patch for different function in bookmark-template.php
bookmark-template-php-NEW.diff (1.1 KB) - added by jhodgdon 17 years ago.
New patch compatible with new term/category structure of 2.3 bleeding
bookmark-template-php-2-3.diff (2.0 KB) - added by jhodgdon 17 years ago.
New patch using sanitize_bookmark_field function for 2.3
wp-links-opml-2-3.diff (659 bytes) - added by jhodgdon 17 years ago.
Replacement patch for wp-links-opml.php

Download all attachments as: .zip

Change History (27)

@jhodgdon
18 years ago

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

@jhodgdon
18 years ago

Diff file for wp-links-opml.php

#1 @jhodgdon
18 years ago

  • Owner jhodgdon deleted

#2 @jhodgdon
18 years ago

  • Owner set to jhodgdon

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

#3 @jhodgdon
18 years ago

  • Owner jhodgdon deleted

#4 @ryan
18 years ago

Also needed in _walk_bookmarks().

@jhodgdon
18 years ago

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

@jhodgdon
18 years ago

patch for wp-admin/link-import.php

#5 @jhodgdon
18 years ago

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.

#6 @jhodgdon
18 years ago

  • Keywords has-patch added

#7 @ryan
18 years ago

  • Owner set to ryan

#8 @jhodgdon
18 years ago

  • Cc jhodgdon added

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...

@jhodgdon
18 years ago

Another patch for different function in bookmark-template.php

#9 @jhodgdon
18 years ago

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.

#10 @ryan
18 years ago

  • Resolution set to fixed
  • Status changed from new to closed

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

#11 @jhodgdon
17 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

#12 @rob1n
17 years ago

  • Owner changed from ryan to rob1n
  • Status changed from reopened to new

#13 @rob1n
17 years ago

  • Milestone changed from 2.2 to 2.3

@jhodgdon
17 years ago

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

#14 @jhodgdon
17 years ago

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.

#15 @jhodgdon
17 years ago

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...

@jhodgdon
17 years ago

New patch using sanitize_bookmark_field function for 2.3

#16 @jhodgdon
17 years ago

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.

@jhodgdon
17 years ago

Replacement patch for wp-links-opml.php

#17 @jhodgdon
17 years ago

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.

#18 @ryan
17 years ago

  • Priority changed from normal to high

#19 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.