Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to get a list of users to be displayed in a user defined order on a page.

I've set up a custom field team_display which the user can define with a list of comma separated names (ex: John Doe, Jane Doe, Bob Smith). I can use php explode() to get them into an array. How do I take these names and search for them using WordPress functions like get_users() and then display their meta information in that order?

I've spent a hours on this, but can't seem to figure it out. Thanks for any help.

Edit to further clarify:

I have profile listing page setup like so http://imm.io/8szu. The info is populated from the user meta data of actual WordPress user accounts. I just want to be able to list them in a user defined order: Brian, then Bob, then Joe, etc.

If I create a custom field *team_display* on the page holding the string "Brian, Bob, Joe". How can I then use that to display those users in that order. Thanks!

share|improve this question
Where is this custom field, in the user profile? – Wyck Aug 24 '11 at 22:05
No, it's just on the page--although I welcome whatever method is easier. – wired Aug 25 '11 at 4:37
No one has any ideas? – wired Aug 26 '11 at 19:13

closed as not a real question by toscho Jul 10 '12 at 21:43

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

Well this is not how it works, get_users() has nothing to do with your page's custom meta box.

If you have a meta box with names on your page ( as in the default custom fields) then you need to get them using the actual meta box functions, like the following,

get_post_meta http://codex.wordpress.org/Function_Reference/get_post_meta using $single parameter set to false to return an array.

share|improve this answer
I know, but my question isn't about post meta. I'm trying to get a list of users displayed in a certain order on a page. Whether that order is stored as a value in user meta data or on the page itself is immaterial. I know how to display meta data. I'm just concerned about the order. Sorry for any confusion. Thanks! – wired Aug 25 '11 at 5:08
You know what would be helpful? Mentioning what you mean by order? Alphabetically? Birth day? favorite color? – Wyck Aug 25 '11 at 5:30
I've edited my post to help clarify. Let me know if you have any further questions. Thanks! – wired Aug 25 '11 at 6:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.