Hi Everyone
I am hoping someone may have encountered this before or may be able to point me in the right direction.
I have used the following code snippet:
Add user dropdown: https://formidableforms.com/knowledgebase/frm_setup_new_fields_vars/#kb-add-user-dropdown
The User from the dropdown is saved as the user ID when submitted and it all works fine.
However, I would then like to use that field in a view but display the display_name and not the ID as it currently does as that is what is saved to the DB.
$values['options'][] = array( 'label' => $user->display_name, 'value' => $user->ID );
I did try saving the value as the display_name but then one can not use the filter:
User ID - is equal to - current_user
Would anyone be able to suggest a way of doing this and any changes I need to make?
Many thanks Mark
If your view is showing the data for the logged in user, you can follow these directions, however, I'm guessing that's not what you're doing, so my suggestion is a making a custom shortcode that takes the id as a parameter and then uses the WP functions to get the information from user object. It'd only be a few lines of PHP.
Hi Rob. Thank you very much for your answer. You are right it is not a User ID field unfortunately so those shortcodes will not work. Are there any support documents you know of that would get me started on creating a custom shortcode for what I would like?
It's your lucky Black Friday special day because I just wrote a tutorial a few days ago on this topic specifically.
https://connect.formidableforms.com/user-tutorials/custom-shortcode-creation-basic/
Hi Rob
That is great thank you very much.
Thanks Mark
Please login or Register to submit your answer