Skip Navigation

[Resolved] CRED add user field to post field

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 3 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1727673

I would like to add the user-meta 'nickname' field to a post form as a select field. How can I do that?

#1727875

Hello,

It is possible with custom codes, see the solution of below thread:
https://toolset.com/forums/topic/dropdown-that-shows-all-users/#post-590063

Above codes are based on wpt_field_options filter hook, see our document:
https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options

For your reference.

#1728497

My issue is resolved now. Thank you!

#1728499

One more question - is there a way to exclude users from the select field - say only show users in specific permission levels?

#1728859

In your custom PHP codes, you can specific user roles in function get_users(), see WP document:
https://developer.wordpress.org/reference/functions/get_users/
https://developer.wordpress.org/reference/classes/wp_user_query/prepare_query/

#1732809

So I cannot do this from within toolset?

#1732837

As I mentioned above, there isn't such kind of built-in feature within Toolset plugins, it needs the custom codes, see the example I mentioned above:
https://toolset.com/forums/topic/dropdown-that-shows-all-users/#post-590063

Above example is using WordPress built-in function get_users() to retrieve user lists
https://developer.wordpress.org/reference/functions/get_users/

You can customize the parameters of function get_users() manually:
https://developer.wordpress.org/reference/classes/wp_user_query/prepare_query/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.