I am trying to: Update the WordPress user display name via a custom field value in a Toolset post edit form using cred_submit_complete and wp_update_user() in a custom code snippet
Link to a page where the issue can be seen:
I expected to see: The updated user's display name in addition to the other updated custom fields submitted by the form.
Instead, I got: The user display name and all custom fields are updated as expected however, a form notification from a user edit form is being sent every time the post edit form is updated. If I remove wp_update_user() from the custom code snippet, the errant email notification from the user form is no longer sent when the post edit form is updated.
The settings for the notification on the user form is "when custom fields are modified and only if the field value has changed". It's set to sent a notification to the user only if one particular custom field is changed and equals "approved".
Correct, I am not changing the custom field with value "approved" but there are other custom user fields that may get updated based on the information submitted by the post edit form.
We have two known issues with Form notifications, and I've been doing some testing to see whether they apply to User Forms (they are reported for Post Forms).
With the first issue, notifications are being sent whenever *ANY* user meta is changed (so long as the condition is met) rather than only when the field being tested has changed value.
Is your custom field with value "approved" a radio field?
Sorry, one last thing. From your various replies I can't tell whether the field with value "approved" is actually set to approved, or whether it is set to something else and the notifications are being sent even though the field value doesn't match the requirement in the notification.
So you are either covered by that first erratum already (it just needs updating to say that user forms are affected as well as post forms), or I need to test that second erratum to see if the problem reported for radio fields affects select fields, too.
Yes, the custom field value is set to "approved" when the user form notifications are sent - whether the field value has been changed or not. The field value does indeed match the notification requirement for the form.
OK thanks, that means this is covered by that first existing issue.
I'm escalating this thread and attaching it to the same internal ticket.
We'll update the erratum to make it clear user forms are affected, too, and I've asked to give some priority to fixing this as the issue has already been open for a while.