Friday, April 26, 2024
HomeWordPress DevelopmentShip e-mail to consumer if their position is modified to Writer

Ship e-mail to consumer if their position is modified to Writer


I would love an e-mail to be despatched to the consumer when their position is modified to Writer.

The code beneath sends an e-mail when a consumer’s position is modified to any position, however I would love it solely to ship if the position is modified to ‘Writer’.

perform user_role_update( $user_id, $new_role ) {
        $site_url = get_bloginfo('wpurl');
        $user_info = get_userdata( $user_id );
        $to = $user_info->user_email;
        $topic = "Function modified: ".$site_url."";
        $message = "Hi there " .$user_info->display_name . " your position has modified on ".$site_url.", congratulations you at the moment are an " . $new_role;
        wp_mail($to, $topic, $message);
}
add_action( 'set_user_role', 'user_role_update', 10, 2);

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments