Skip Navigation

[Resolved] Send email notification to parent's author

This support ticket is created 7 years, 3 months 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.

Our next available supporter will start replying to tickets in about 1.56 hours from now. Thank you for your understanding.

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

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Valeriia 7 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#471172

Hello,

I found this thread - https://toolset.com/forums/topic/cred-notification-2/, but it's not working for me.

I added the parent author's email as a generic field, but it's still not visible in the settings (Where to send this notification / Send notification to an email specified in a form field).

Please advise.

[cred_generic_field field='_parent_email' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"default":"[wpv-user field='user_email']"
}
[/cred_generic_field]

By the way, I wanted to attach a screenshot, but the Upload Image link didn't work.

Thanks.

#471418

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you used the `hidden field that's the reason you are not able to see the field in the settings. You need to go with one of the solution as given under:

Solution 1:
-- Setup your field as 'email' and chceck if its available in settings and this works but the field will be dispalyed with your form.

[cred_generic_field field='_parent_email' type='email' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-user field='user_email']"
}
[/cred_generic_field]

Solution 2:
-- If you do not want to display the parent email field with your form and you want to go with the hidden field then you need to use hook: cred_notification_recipients

add_filter('cred_notification_recipients', 'my_cred_notification_recipients_func', 10, 4);
function my_cred_notification_recipients_func($recipients){
    if (!is_array($recipients)) {
        $recipients=array();
    }
    if (isset($_POST['_cred_cred_prefix_form_id']) && 9999 == $_POST['_cred_cred_prefix_form_id']){
         
        if(isset($_POST['_parent_email']) and $_POST['_parent_email']!=""){
            $recipients[] = array('to'=>'to', 'name'=>'', 'lastname'=>'', 'address'=>$_POST['_parent_email'] );
             
        }
    }
    return $recipients;
}

Where:
-- Replace '9999 ' with your CRED form ID.

I hope above solution will allow you to resolve your issue.

#471671

Hello Minesh,

Thanks a lot for the snippet. The second one didn't work though (the form id is set correct), so I had to hide the fields with css. That will do.

Happy upcoming New Year and thanks for all the help 🙂

#471689
s2016-12-29.png

Sorry, have to re-open.

I set everything and the generic fields display correct information in front-end (parent author email, name and last name).

[cred_generic_field field='_parent_email' type='email' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-user field='user_email' id="[wpv-post-author format='meta' meta='ID']"]"
}
[/cred_generic_field]

[cred_generic_field field='_parent_name' type='textfield' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-user field='user_firstname' id="[wpv-post-author format='meta' meta='ID']"]"
}
[/cred_generic_field]

[cred_generic_field field='_parent_lastname' type='textfield' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[wpv-user field='user_lastname' id="[wpv-post-author format='meta' meta='ID']"]"
}
[/cred_generic_field]

The notification is set to go to that email (see screenshot).

But in reality it does the opposite - the email goes to the sender himself.
I.e. if I'm logged-in and submit this form, I receive the notification myself, not the email specified in the _parent_name.

Am I doing anything wrong?

Thanks.

#471694

My bad, sorted out. Thanks.

#474347

Hi Minesh,

I'm sorry for not replying, I'm giving all my time to another project at the moment. If you still need me to give you the access, I can do it over the weekend (please enable private response in that case). Otherwise it's solved for me at the moment.

Thanks.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.