Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'publish_post', 'fep_cus_user_publish_send_messaage', 10, 2 );
- function fep_cus_user_publish_send_messaage( $ID, $post ){
- if ( ! function_exists( 'fep_send_message' ) )
- return;
- $message = [];
- $message['message_to_id'] = $post->post_author; // Post author ID.
- $name = get_the_author_meta( 'display_name', $post->post_author );
- $title = $post->post_title;
- $permalink = get_permalink( $ID );
- $message['message_title'] = sprintf( 'Published: %s', $title );
- $message['message_content'] = sprintf ('Congratulations, %s! Your article ā%sā has been published.' . 'nn', $name, $title );
- $message['message_content'] .= sprintf( 'View: %s', $permalink );
- $override = array('post_author' => 1);//change with message sender id
- // Send message
- fep_send_message( $message, $override );
- }
Add Comment
Please, Sign In to add comment