Home Forums Plugin Support WP User Frontend Pro Assistance With Two Items

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  LJA32118 5 years, 12 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4201

    LJA32118
    Participant
    Post count: 7

    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:

    < ?php echo get_post_meta( $post->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!!

    #4202

    Tareq Hasan
    Keymaster
    Post count: 2831

    [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.

    #4205

    LJA32118
    Participant
    Post count: 7

    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 3 posts - 1 through 3 (of 3 total)

The topic ‘Assistance With Two Items’ is closed to new replies.