I have a form where a user can request to be linked to their partner's account. I would like the form to send them a notification that their request has been denied if I update the "user-partneremail" field back to being blank. However, when I change that user field's value (from the WordPress admin console) WordPress bombs and says it cannot handle the request.
When I remove the notification (see attached) from the Toolset Form, the error does not occur. Am I misinterpreting the use of this notification field? Thanks for your support.
- Aaron
Hi, can you try a couple of tests?
- Replace the wpv-user shortcode in the recipient field with a hard-coded email address. Test again.
- Keep the hard-coded email address, and remove all the contents from the notification body. Replace the contents with some simple text, no shortcodes or placeholders. Test again.
Let me know what you find out and we can go from there.
Hi Christian,
Okay, I've done a few more tests - the ones you suggested along with some others. At a high level, I think the error is only occurring when I try to make the "partner e-mail" field blank and don't put an e-mail address in. It's not set as a required field so not sure why it would be trying to validate it if being set to null.
1) First I reactivated the notifications and changed the e-mail address to hard coded. Upon submission, all notification e-mails came in at the same time even though the fields that were supposed to trigger the notifications hadn't been changed (they came to the hard-coded e-mail address, which is different than what e-mail address it would have been if it had used the user's address o their account).
2) Second, I tried modifying the user's account and saving the changes, and the error occurred. Repeated this several times.
3) Next, I tried modifying another user's account by updating the same field. No error.
4) Removed the shortcode from the body of the e-mail and re-submitted the form. E-Mail notifications came even though the conditions of the field being changed were not met. Condition said to only send if field gets changed to "" whereas the field got changed to an e-mail address. Edit user page still crashing in WordPress after updating field.
5) Tried editing a different field besides the one referenced in the notification (changed user first name) and no error.
6) Tried updating the field referenced in the notification but instead of making it blank I put in a fake e-mail address. No error!
Can you see if you can duplicate this error?
-- Create a custom user field called "user-partneremail" set to email field type, not required, only allow one value, validate as an e-mail address.
-- Add an e-mail address to a user's account.
-- Try removing the e-mail address by making it blank (from the admin console).
I'm thinking it's trying to validate the field even if trying to clear the field. I could remove the validation but I still want it to validate the e-mail address when the user does the initial submission.
- Aaron
Update. Now I set the notification to send only if the partneremail field gets updated to "blank@blank.com". Screenshot attached. After submitting the form, when I updated the user account by changing the partneremail field to blank@blank.com, it crashed again. Guess maybe I was wrong in my previous message.
I'll leave you with all that and see what you think I should do next. Thanks.
- Aaron
PS: Sorry about all the messages. Should've put it all in one.
-- Try removing the e-mail address by making it blank (from the admin console).
No, I'm not able to replicate this behavior with only Types, Views and Forms active and a default theme. What is this Edit User form set to do after submission?
Let's try to narrow down the problem since I can't replicate it. Please temporarily deactivate all plugins except Types, Views and Forms, and activate a default theme like Twenty Seventeen. Then retest. If the problem is resolved, reactivate your Theme and Plugins one by one until the conflict is revealed.
If the problem is not resolved by deactivating plugins and theme, please turn on server logs to see if WordPress generates any server-side errors when you attempt to change the field in wp-admin and it bombs.
Hi Christian,
I deactivated all non-Toolset plugins and switched back to Twenty Seventeen and the problem is still occurring. The thing that's been making it even trickier is that I can't seem to ever find anything in the logs. Let me know specifically what logs you want me to check.
- Aaron
- What is this Edit User form set to do after submission?
- When you say the site bombs, what specifically happens - are you shown an error on the screen? Does the page hang or time out? If you can't see anything visually on the screen, open the browser console and see if anything is in the page source. Perhaps something is hiding an on-screen error, which might indicate why you don't see any errors in the logs.
Truly bizarre. I just went through all the same steps again, taking screenshots along the way (see attached), and the error did not happen! The only thing I can think of I've done since our last interaction was I installed a patch for stopping an AJAX error upon clicking "send test e-mail" from forms. Don't know if they're related or if something else is going on.
In any case, when I changed the users "master user" field a notification did not fire. Am I misinterpreting the field functions in that the notification only goes right when the form is submitted or not at all? Being that it comes right after "send when status changes to published" (on post forms anyhow) I assumed it meant these were things that happened later (and the documentation I read was not explicit).
Okay I'm seeing something strange in my local testing now, and it seems to only happen when I edit the field directly in wp-admin (not in a CRED form). Are you testing updating the field in CRED, or in wp-admin, or a combination of both?
The issue I was having was happening in the wp-admin section. The Toolset Form is just for the end-user to change one field (partner e-mail). Once their partner confirms their account then I, as the admin, would go into wp-admin and update the user record directly. This is when it was error-ing out. Sorry if I didn't explain that well enough before.
- Aaron
Okay thanks, I made a clone of your current site and I was able to reproduce the error I saw on my own local site, but I'm still trying to pin down the steps necessary to recreate it. I'll update you soon.
For your reference, here is the error:
Fatal error: Uncaught InvalidArgumentException in /path/to/site/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/inc/m2m/association/query/condition/element_id_and_domain.php:57 Stack trace: #0 /path/to/site/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/inc/m2m/association/query/condition_factory.php(130): Toolset_Association_Query_Condition_Element_Id_And_Domain->__construct(false, 'posts', Object(Toolset_Relationship_Role_Child), Object(Toolset_Association_Query_Element_Selector_Provider), false, true) #1 /path/to/site/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/inc/m2m/association/query/association_query_v2.php(497): Toolset_Association_Query_Condition_Factory->element_id_and_domain(false, 'posts', Object(Toolset_Relationship_Role_Child), Object(Toolset_Association_Query_Element_Selector_Pr in /path/to/site/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/inc/m2m/association/query/condition/element_id_and_domain.php on line 57
I was able to reproduce the fatal error consistently with these steps:
- install duplicator clone, do not activate wordfence plugin
- log in as t----et
- enable all 3 email notifications on user form 188
- go to WooCommerce > Settings > Advanced and disable "Force secure checkout" because I'm on HTTP
- log in as cr-----oo
- go to /my-profile/partner-signup
- change partner email to "blank@blank.com"
- log in again as t----et
- edit cr----oo User in wp-admin
- change first name to "felixs"
Now I'm able to escalate this to my 2nd tier support team for additional analysis. Stand by and I'll let you know what I find out.
Hi Christian,
I thought I would add to this that something else has started happening that's a little strange. Now, whenever I edit the same user's account details, I receive an e-mail notification from a totally unrelated form. The odd thing is that the other form is not a user form but a post form, and it happens to be the same form being investigated under a separate ticket:
https://toolset.com/forums/topic/conditional-notification-based-on-checkbox-doesnt-work/
Not sure if it's relevant here but thought I would mention it since the ticket you're investigating is for the form that's supposed to trigger a user based notification.
- Aaron
One more addition to note here: I've noticed e-mails coming erroneously from a third form now. The form "Form-Member-Profile-Edit" has zero notifications assigned to it yet whenever I submit the form I receive an e-mail notification that was setup in the form "Form-Member-Connection-Edit".
- Aaron