Hi,
I have a view called "Users" that is used to populate the "library" field (select field) in several CRED forms.
The "biblioteca" field in the CRED form should automatically populate with the name of the user currently logged into the site.
I followed this topic 2 years ago and everything has worked so far.
https://toolset.com/forums/topic/cred-form-to-select-author/
A few weeks ago I had to add new users and for these new users the automation in the CRED form is not running. The "biblioteca" field does not populate.
Here you can see the content that generates the view used in the CRED form:
hidden link
Here you can see the content that generates the view used in the CRED form
In the utenti-id page I see correctly all the values, while calling the view in the CRED form to populate the select of the field "biblioteca" it generates me a result without the new users as:
{"value":"126","label":"Petosino"}
or
{"value": "127", "label": "Torre de Busi"}
The reference CRED form is "Aggiungi Evento" - hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
To troubleshoot this, I'll need to see how this view is set up in the admin area.
Can you please share temporary admin login details, in reply to this message?
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing these details.
In the form "Aggiungi evento" there are different fields, related to what you've shared:
1. The generic select type field "my_author_select":
( screenshot: hidden link )
This field is to get the options from the view "Utenti" and it is showing those options correctly, as expected.
Note: that view is set to show the users belonging to the two roles "Bibliotecari" and "Sistema SBI" only, and it is showing a total of 64 options correctly.
2. The custom field "Biblioteca":
( screenshot: hidden link )
This field's options are registered in the field definition in the field group named "Eventi biblioteche" and are showing as expected in the form too.
( screenshot: hidden link )
In the form, this field is set to have the currently logged-in user's ID set as a default using the shortcode: [wpv-user field="ID"].
( screenshot: hidden link )
But this default selection will only work if the currently logged-in user's option exists in the field's settings in the field group "Eventi biblioteche".
For example, the user that I logged in with has no options added in the field's settings, so when I see the form on the front-end, I don't see any user selected in the "Biblioteca" field.
But, if any user for example "Sistema bibliotecario" will see the form on the front-end, then that user will be automatically selected in that field because an option for that user exists in the field's settings.
I hope this explanation helps in understanding why the default selection is working for some users and not for others.
All clear. I forgot about that crucial passage.
Thank you very much