I am trying to:
Create a custom page to streamline editing specific users based on their associated programs.
Link to a page where the issue can be seen:
I created a custom WordPress admin page, which takes a user_id parameter and generates a Toolset CRED User Form using the PHP snippet.
When editing a user with values already set for Select fields the form shows either the default preset value for a new user OR the -- Select -- even when the user has values already present (the values ARE visible in the /wp-admin/user-edit.php page)
I expected to see:
The current values for the existing user displayed as the selected options in the Select lists.
Instead, I got:
Empty selections or the field default values.
Hello. Thank you for contacting the Toolset support.
As I understand, you have created the Edit User (profile) form using Toolset User form and that form you are displaying using the Form's PHP API function cred_user_form().
Your concern is when you edit the user profile from admin, you have custom select dropdown field from where you set specific option and now when you edit the same user using the Toolset form that custom select dropdown field do not display the option as selected option which you set from editing the user profile from admin - correct?
If yes: I will require access details as well as link of the page where you added the user form.
Minesh is on vacation this week. If you don't mind, I'll continue with you on this thread.
Toolset forms are meant to be used on the frontend, using them on the backend is not a supported feature. In fact, I created a private page and used the form on it, the issue was not reproduced. Check it here hidden link
Some fields, like ID, were not rendered. But that's another issue, that we can handle later.
To confirm, if this is a supported feature, let me ask our developers about it, and I will get back to you as soon as possible.
Thanks for jumping in, can we verify this works using the PHP API to make sure this works, because I need to be able to set which User ID to Edit in the URL as this will be a "Management Page" for Admin's to review "other" users.
With the current method of using the Shortcode on the front-end it's only changing the current logged in user, and there's no easy way to make the user_id dynamic in the current approach to match my use case.
I would really like it to work within the Admin because then I can rely and making "Admin" functionality central within the WordPress admin, otherwise I'll need to figure how to make users with certain capabilities use the User edit form on the front-end which seems like working around a core issue.
Any help from the developers would be greatly appreciated, I understand this might be more of an edge case, however User forms that edit other users would likely be something very common within an Admin, not so much within the Front-End.
Our developers confirmed that we have some checks against a form being used on the frontend before running some code. As a general rule, the forms are supposed to be used in the frontend.
As a workaround, I suggest that you use the form on a regular WordPress page, then use it on an Iframe in your admin area page. You can then, add a Javascript code to the form that will check that it is being on an Iframe, otherwise, redirect to the admin area page. Check this hidden link.
Does it make sense?
I hope this helps. Let me know if you have any questions.