Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24273 closed enhancement (fixed)

Provide a way for Theme/Plugin developers to get a list of user contact methods

Reported by: johnnyb's profile johnnyb Owned by: nacin's profile nacin
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch
Focuses: Cc:

Description

When templating an author page it is useful to be able to provide a list of social media links. There's great support for adding custom links using the user_contactmethods filter, but there's no public way to get a list of those contact methods without the user's other info mixed in.

There is a private function _wp_get_user_contactmethods(), that does this. Why not make it public?

Attachments (2)

24273-public-contactmethods.diff (2.3 KB) - added by johnnyb 11 years ago.
Make the method public.
24273-user.php.diff (583 bytes) - added by johnnyb 11 years ago.
Public wrapper for private method.

Download all attachments as: .zip

Change History (9)

#1 @johnnyb
11 years ago

I'll submit a patch in a few minutes.

@johnnyb
11 years ago

Make the method public.

#2 follow-up: @johnnyb
11 years ago

  • Keywords has-patch added

Patch added. It simply declares the function public, and removes the _ from the beginning of the function name, (and from calls to the function).

We could also provide a private wrapper for the public function if we need to reserve the right to modify the private implementation at some point.

#3 in reply to: ↑ 2 @SergeyBiryukov
11 years ago

I guess the cleaner approach would be to leave the private function as is and introduce a public wrapper.

@johnnyb
11 years ago

Public wrapper for private method.

#4 @johnnyb
11 years ago

The new patch uses the public wrapper instead of renaming the private method.

#5 @ramiy
11 years ago

Related: #24952

#6 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#7 @nacin
11 years ago

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

In 25606:

Introduce wp_get_user_contact_methods() as a public version of _wp_get_user_contactmethods.

props johnnyb.
fixes #24273.

Note: See TracTickets for help on using tickets.