Ok, I created two radio buttons (Trocar Perfil and Trocar Fotos). I already added them to the Edit Form. Now you can do your magic.
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
I've modified the code and sent out a test mail.
Please let me know as soon as you get this mail.
Thanks,
Shane
I got the email but my question is this, you only changed the field name to when the user deletes the profile picture. Do I have to duplicate your JQuery code in order to do the other pictures?
Also, once the user changes the pictures the first time, the radio changes to YES, but let's say he wants to change the pictures tomorrow again, will the radio be back to default as NO, or will keep YES because of the first time he changed the pictures?
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
Right now the code is targeting when the user clicks the x button to delete the image. This will trigger the js to set the code to yes.
If you set the default answer to NO in the types field setting then each time the page is loaded it will default to NO. It will only change to YES once the user makes the change on the photo.
However when the user changes it to YES we will need to default it to NO because that YES value will be saved to the post itself.
jQuery( document ).ready(function() {
jQuery('input:radio[name=wpcf-trocar-perfil]').filter('[value=2]').prop('checked', true);
});
Add this code to the forms js as well and it will default the field to NO on page load.
Thanks,
Shane
Got it!
When you say:
Right now the code is targeting when the user clicks the x button to delete the image.
Do you mean any X, either be single image or multiple images?
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
I made the code general because it would be difficult to actually tell. So I hooked it up so once the use clicks to remove any of the images it will trigger the code.
Being able to distinguish between the single image or the multiple images will take a little bit more code and will make it somewhat more complex.
Thanks,
Shane
No that's fine, as long as the code captures one or another, it's ok. I just need to be informed if any image was changed or not.
I'll test it out, and let you know. Thanks
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
Awesome let me know as soon as your tests are done then we can wrap up here.
Thanks,
Shane
I tested but the notification is not sending the email. The user gets his/her notification fine, but the one I set up for Admin is not sending, although the test email works fine.
Look: enlace oculto
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
Thanks for the detailed explanation.
Could you try this scenario for me. What happens if you manually set the field to yes. Just edit the post and manually set the field to yes and then submit.
Let me know if the email is sent then.
Thanks,
Shane
No, it did not work. I followed your instruction and nothing was sent to admin.
Also, now it seems there is an error in the My Account. What could it be?
Notice: Trying to get property 'ID' of non-object in /home/b16f1985/public_html/felipepenna.com/destackterapiastest/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields/image.php on line 1273
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
I'm checking on this for you now.
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
This should be working now.
The issue was that you had the field after the submit button. Please check if you got the emails because I did in my testing.
Thanks,
Shane
So I tested on a couple of custom post and most of them worked fine, except for Tamy's. I'm not sure why I'm not getting an email when she changes her pictures.
Two things:
1) The Notice is still in place and it's coming from Toolset. "Notice: Trying to get property 'ID' of non-object in /home/b16f1985/public_html/felipepenna.com/destackterapiastest/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields/image.php on line 1273"
This showed up after I gave you access to do the changes. It's showing on the home page and on Minha Conta.
2) The other thing that got me thinking is this. I'm allowing a total of 6 pictures for the custom multiple images. If the user puts up 3 right now and tomorrow adds the other images, admin will not receive an email about that. It's a bit important to know when the client adds pictures or changes them. How can we notify the admin of such things?
![](https://secure.gravatar.com/avatar/f3c36bb8920f6b75cd720f131c6a9065?s=80&d=mm&r=g)
Shane
Supporter
Idiomas:
Inglés (English )
Zona horaria:
America/Jamaica (GMT-05:00)
Hi Felipe,
I've added this code as well for when the user clicks the add new button.
jQuery( ".js-wpt-repadd " ).click(function() {
jQuery('input:radio[name=wpcf-trocar-perfil]').filter('[value=1]').prop('checked', true);
});
Thanks,
Shane