WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 6 years ago

Last modified 6 years ago

#13235 closed enhancement (duplicate)

Simplify and add filtering to call to display author for media

Reported by: sbressler Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Media Keywords:
Focuses: Cc:

Description

The author displayed on the media page (upload.php) is not filterable in any way currently. This patch adds a filter for the author ('media_author'). Perhaps more filters should be added for other fields, but at the least I would like to add this filter.

Attachments (6)

13235.diff (1.1 KB) - added by sbressler 10 years ago.
13235.2.diff (594 bytes) - added by sbressler 10 years ago.
Call the_author for unattached media just like attached media
13235.3.diff (1.0 KB) - added by sbressler 10 years ago.
13235.4.diff (763 bytes) - added by sbressler 10 years ago.
Refresh for WordPress 3.1 with list-table-media.
13235.5.diff (872 bytes) - added by sbressler 10 years ago.
Use WP functions to generate URL (per Nacin's request)
13235.6.diff (618 bytes) - added by sbressler 10 years ago.
Again, a refreshed patch for the changes to trunk.

Download all attachments as: .zip

Change History (22)

@sbressler
10 years ago

#1 @nacin
10 years ago

It looks like there are already filters that can be leveraged for this.

#2 @sbressler
10 years ago

Perhaps I'm missing something, but which? The only other one I see in upload.php or edit-attachment-rows.php is 'media_row_actions', but that's specifically for the actions available to something in the media library I think.

#3 @nacin
10 years ago

the_author and get_the_author have filters.

Doesn't look like the direct setup_userdata call can be changed easily. That said, if you want to filter the entire column, why not remove the column and add your own?

Leaving in 3.1 for sure as that's the earliest we're going to touch media/upload. When we do, we're likely going to break a lot, and we don't want more filters in place we need to at least consider back compat for.

#4 @sbressler
10 years ago

Well, one could filter 'the_author' and/or 'get_the_author_display_name', which actually does seem like a better idea than adding this filter. However, then the code in upload.php should probably be changed to use the_author or run through the filter instead of echoing $author->display_name. Thoughts?

#5 @sbressler
10 years ago

  • Summary changed from Add filter for author on media page to Simplify call to display author for unattached media

Thanks for the feedback, nacin. I was making this much harder than I realized. Now I would just propose simplifying the way the author is called for unattached media.

@sbressler
10 years ago

Call the_author for unattached media just like attached media

#6 @sbressler
10 years ago

  • Summary changed from Simplify call to display author for unattached media to Simplify and add filtering to call to display author for media

@sbressler
10 years ago

#7 @sbressler
10 years ago

  • Keywords has-patch added

#8 @nacin
10 years ago

  • Keywords needs-refresh added; has-patch removed
  • Milestone changed from Awaiting Triage to Future Release

Future release for now, as these need refresh against trunk due to the list tables.

@sbressler
10 years ago

Refresh for WordPress 3.1 with list-table-media.

#9 @sbressler
10 years ago

  • Keywords has-patch added; needs-refresh removed

Added a refreshed patch. Should be good to go for 3.1.

#10 @nacin
10 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 3.1

@sbressler
10 years ago

Use WP functions to generate URL (per Nacin's request)

@sbressler
10 years ago

Again, a refreshed patch for the changes to trunk.

#11 @sbressler
10 years ago

I hope that the above patch can be committed soon so I can stop refreshing it :)

#12 @nacin
10 years ago

  • Keywords 3.2-early added
  • Milestone changed from 3.1 to Future Release

#13 @sbressler
9 years ago

Just tested this on tip of trunk and the latest patch (13235.6.diff) still works great. However, I realized that it no longer achieves the purpose I was hoping. While the author text displayed can be filtered using the standard 'the_author' filter, the href added cannot be filtered as desired. Any ideas for how this could be achieved properly? Would adding a separate filter like originally proposed (first patch uploaded) be that bad an idea?

Would like to get this in before 3.2 freeze so I can stop thinking about this year-old ticket.

#14 @ericlewis
6 years ago

  • Keywords has-patch commit 3.2-early removed
  • Resolution set to worksforme
  • Status changed from new to closed

This was fixed in r23430

#15 @SergeyBiryukov
6 years ago

  • Resolution changed from worksforme to duplicate

Duplicate of #16044.

[23430] doesn't allow for filtering the URL. Feel free to reopen if that is still relevant.

#16 @SergeyBiryukov
6 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.