We do not have any plans to add a Custom Field that is automatically populated with WordPress users.
It requires a huge new setup.
What should be returned there?
The ID; the Email, the username...?
How should it be rendered? which roles should be returned?
Please let me know what you think in regard, so I can eventually escalate a request.
As for now please follow this instructions:
1. Create a user View
2. This (or similar) in the loop:
<wpv-loop>[wpv-item index=1]{"value":"[wpv-user field="ID"]","label":"[wpv-user field="user_login"]"}
[wpv-item index=other],{"value":"[wpv-user field="ID"]","label":"[wpv-user field="user_login"]"}
</wpv-loop>
3. Apply this Filter to this View in functions.php:
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );
function prefix_clean_view_output( $out, $id ) {
if ( $id == '375' ) { //change this View ID accordingly
$start = strpos( $out, '<!-- wpv-loop-start -->' );
if (
$start !== false
&& strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false
) {
$start = $start + strlen( '<!-- wpv-loop-start -->' );
$out = substr( $out , $start );
$end = strrpos( $out, '<!-- wpv-loop-end -->' );
$out = substr( $out, 0, $end );
}
}
return $out;
}
IMPORTANT NOTES ON THIS FILTER ABOVE:
- It hooks early in the View output.
- Priority 5 is mandatory as we already do some other cleaning at priority 10.
- It only affects a View with an ID of 375, adjust acordingly if needed.
- It only affects Views with actual results: if the View matches no result, the same “No items found” or whatever you have between the wpv-no-items-found shortcode applies.
- It returns only what is between the HTML comments <!– wpv-loop-start –> and <!– wpv-loop-end –> , excluding them. Only content between those HTML comments is returned, as is.
Notice that, with this applied to a given View ID:
- Pagination, specially AJAX pagination, will not work.
- Parametric search, specially AJAXed parametric search, will not work.
- Other future features will not work either.
4. In the CRED form use this (or similar):
[cred_generic_field field="user" type="select" class="" urlparam=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":[],
"options":[ [wpv-view name="All WP Users"] ]
}
[/cred_generic_field]
5. Then use the CRED API and craft a Custom PHP code to update the Types Field so you will have this editable in the backend too.
https://toolset.com/documentation/user-guides/cred-api/#csd
This is what you can do currently with Toolset.
Other Plugins might provide user Select Lists as Custom Fields, but we can not support this, it will need some tests first.
Advanced Custom fields presents problems with Toolset because that plugin sometimes stores Fields in a very unusual way, not following strict WordPress Codex.
Thank you