Problem:
I have created a custom user field called user category which is a checkbox field so a user can tick multiple boxes when registering. If you could help me to get the Custom Field value of the user in the query. If custom field is checkboxes types, how can I check which checkboxes in group are checked?
Solution:
To get the User’s custom field value and to get the selected & saved value for a checkbox using code, we have a way for this as examples in our Types API. You would do it something like below, to insert Types user meta fields using PHP code, use the following function and syntax:
<?php echo(types_render_usermeta( 'field-slug', array( 'arg1' => 'val1', 'arg2' => 'val2' ) )); ?>
Couple more examples:
<?php echo types_render_usermeta( 'my-checkboxes', array( "user_id" => $curauth->ID ) ); ?>
types_render_field( "my-checkboxes", array( "separator" => ", " ) )
Relevant Documentation:
- For more info, please go to this link and Click on MORE and see How to use this field with php:
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes
Also please see the info at the very top of this page.
- Old ticket: https://toolset.com/forums/topic/how-to-display-types-user-fields-on-author-page/
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | - |
- | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
This topic contains 4 replies, has 2 voices.
Last updated by 7 years, 1 month ago.
Assisted by: Noman.