[Resolved] dynamic select options for cred user form fields
This support ticket is created 6 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.
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.
I would like to set dynamic option values for a select field for a cred user form field, using a shortcode or a view, just like I can do with cred_generic_field.
Is it possible?
Alternatively, is it possible to save a cred_generic_field as user field value in the database?
Thanks in advance, Luca
Where:
=> You should change 'Status' to your custom field status.
=> You should change the "Subscriber" to your desired role.
Please feel free to adjust above code as per your need.
Alternatively, is it possible to save a cred_generic_field as user field value in the database?
==> What if you use CRED hook cred_save_data and use update_user_meta() function to update the value for your generic field accordingly.
Hi
thank you very much, filter solutions works fine, I'm able to set select options with php.
There's just a little problem in WordPress User editor
I can see (and modify) option values for types user fields with option manually defined in User Field Group editor, but for user fields with options defined via php the value always seems to be empty, even if wpcf-<fieldname> meta values is ok in wp_usermeta table.
It seems that wpt_field_options works only with cred forms: is there any other filter or method I can use?
I'm using two Types select user fields, and everything is ok even in WordPress Standard User editor, now: I just have to delete and re-create fields...
Thanks for your help.
Best regards
We have two fields, let's say wpcf-field1 and wpcf-field2: the first one has static select options defined via wp-types user group fields editor, the second one has no options, all options are managed with wpt_field_options filter.
In WordPress standard User Editor we were able to see only wpcf-fields1 select options, wpcf-field2 select seems to be empty.
I don't know why, but we've deleted and recreate fields with the same name and now everything works fine...
Thanks again, Luca