This topic contains 6 reply and 2 voices, and was last updated by ronilagin 6 years, 6 months ago
Viewing 6 Posts - 1 through 6 (of 6 total)
Author Posts
April 30, 2013 at 2:51 pm 3026
ronilagin Is there a way to send an email to the admin and the user confirming the post details? Also, is there a way to remove a users credits once they expire? The reason I'm asking is because currently users are able to access areas that I have set to be limited to people with credits, even though their credits are expired. Thanks!
April 30, 2013 at 3:02 pm 3027
Tareq Hasan Tareq Hasan

With the notification settings, can’t you already send post details to the admin? If you want to send the notification also to the post author, it can be done.

May be something wrong with your credits checking. It should be false if either credit becomes zero or it expires.

April 30, 2013 at 3:05 pm 3028
ronilagin ronilagin

Hi Tareq,

How is it done?

Also, I will test the credits thing again to double check.

Thanks,

April 30, 2013 at 3:21 pm 3029
Tareq Hasan Tareq Hasan

[php]
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 );
[/php]

This should work.

May 1, 2013 at 4:49 am 3046
ronilagin ronilagin

Getting a white page when I put that function in functions.php – should it go somewhere else?

May 1, 2013 at 5:13 am 3047
Tareq Hasan Tareq Hasan

There was an unexpected character due to the syntaxhighlighter, try this

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 );
May 1, 2013 at 5:26 am 3048
ronilagin ronilagin

Thank you 🙂

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