Up to 50 percent off

Assistance With Two Items

This topic contains 2 reply and 2 voices, and was last updated by LJA32118 11 years, 5 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
May 25, 2013 at 7:15 pm 4201
LJA32118 I found this code on the Forum that sends a copy of the Notification E-Mail to the author. I need to send the copy to an e-mail in a custom field entitled rmail - which I can access this way: ID, 'rmail', true ); ?>
function wpufe_send_author_notification( $post_id, $form_id, $settings ) {
    $author_id = get_post_field( 'post_author', $post_id );
    $author = get_user_by( 'id', $author_id );
 
    $mail_body = WPUF_Frontend_Form_Post::prepare_mail_body( $settings['notification']['new_body'], 

$author_id, $post_id );
    wp_mail( $author->user_email, $settings['notification']['new_subject'], $mail_body );
}
 
add_action( 'wpuf_add_post_after_insert', 'wpufe_send_author_notification', 10, 3 );
Also - how can I display the author's real first name and last within the "Notification" e-mail? These are custom fields that I created in User Frontend. Great plugin by the way!!
May 25, 2013 at 7:44 pm 4202
Tareq Hasan Tareq Hasan

[php]
function wpufe_send_author_notification( $post_id, $form_id, $settings ) {
$author_email = get_post_meta( $post_id, ‘rmail’, true );
$author_id = get_post_field( ‘post_author’, $post_id );
$author = get_user_by( ‘id’, $author_id );

$mail_body = sprintf("Hello %s %s\r\n", $author->first_name, $author->last_name);
$mail_body .= WPUF_Frontend_Form_Post::prepare_mail_body( $settings[‘notification’][‘new_body’], $author_id, $post_id );

wp_mail( $author_email, $settings[‘notification’][‘new_subject’], $mail_body );
}

add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_send_author_notification’, 10, 3 );
[/php]

It’s a slight modification of that above posts function. It’ll send email to that custom fields email address and prepend “Hi firstname lastname” to the notification mail body.

If you like the plugin and it’s support, please give us a testimonial.

May 25, 2013 at 8:06 pm 4205
LJA32118 LJA32118

Thanks – it works like a dream!! Your support is phenomenal. BTW – I bought the 5 site license so that I could create everything on my development server and then move it to the client’s server. You might want to consider offering developers a two site option.

Viewing 2 Posts - 1 through 2 (of 2 total)