Skip Navigation

[Resolved] cannot choose field to pick user id for notifications

This support ticket is created 4 years 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 10 replies, has 2 voices.

Last updated by Shane 4 years ago.

Assisted by: Shane.

Author
Posts
#1895129

Tell us what you are trying to do?

I am trying to setup an email notification, I have a field ([cred_field scaffold_field_id='assigned-to' field='assigned-to' force_type='field' class='form-control uk-select']) that picks from all of the users (and I believe stores the user ID) however I cannot pick this field (or indeed any field) in the dropdown.

The site is behind a firewall currently unfortunately

Kindest regards,

Pete

#1895267

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Pete,

Thank you for getting in touch.

Based on what I see your field is a regular select field that was created in Types.

However the form requires a Generic field that would provide the user id. This means you will need to use the generic field option in order to do this.

Is this list of users a static list that you populated?

Please let me know.

Thanks,
Shane

#1895365

Hi Shane,

Thank you for the fast reply - the list is populated automatically and is a list of all of the current wordpress users.

Kindest regards,

Pete

#1895369

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-01-05 at 3.10.48 PM.png

Hi Pete,

Ok so this will need to change to use a view to populate the list of users.

Go to Toolset->Views and create a user view and select the roles that you want the view to display.

Then in the view add the following.

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
			[wpv-item index=other]
				{"value": "[wpv-user field='ID']", "label": "[wpv-user field='user_login']"},
			[wpv-item index=last]
				{"value": "[wpv-user field='ID']", "label": "[wpv-user field='user_login']"}
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

Then scroll down to where you see "Disable the wrapping DIV around the View" and ensure that this is checked.

Finally you just need to create a generic select field on your form and use this view to populate the select options.

Like my screenshot.

Please let me know if this helps.
Thanks,
Shane

#1895999

Thank you Shane - there is an option at the end "This field value is an user ID, and should be included in the list of available recipients for notifications"

I assume that this also needs to be checked?

Kindest regards,

Pete

#1896005

Also, whilst this is listing the users it is not saving the data to the field.

Kindest regards,

Pete

#1896277

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Pete,

there is an option at the end "This field value is an user ID, and should be included in the list of available recipients for notifications"

Yes this field needs to be checked as this is the field that you will be using to send the email to the selected user.

Also, whilst this is listing the users it is not saving the data to the field.

You want the field data to be saved? It can be saved but on the backend you will only see the ID of the user in the field, not the username or any information like that.

Please let me know if this is ok.

Thanks,
Shane

#1896721

Hi Shane, Yes I think that is ok - I think that it what was saved from the previous field.

#1897385

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Great, so for the field to actually save you will need to add "persist": 1, to the field in the expert mode of the form.

Please let me know if this helps.
Thanks,
Shane

#1897465

Thank you Shane, This is now working (I had not put the wpcf- prefix into the field, which is why it wasn't working)

The final thing that is illuding me is that I want to notify whoever this is changed to (via a front end form) however, in the dropdown to select "When custom fields are modified" I cannot select this field?

Kindest regards,

Pete

#1897841

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Pete,

So this will pose a challenge, because the field is a generic one then you won't be able to select the field for this.

I've checked and it seems not to be possible to trigger the notification based on the generic field.

Thanks,
Shane