Guest User

Untitled

a guest
Jul 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. add_action( 'publish_post', 'fep_cus_user_publish_send_messaage', 10, 2 );
  2.  
  3. function fep_cus_user_publish_send_messaage( $ID, $post ){
  4.  
  5. if ( ! function_exists( 'fep_send_message' ) )
  6. return;
  7. $message = [];
  8.  
  9. $message['message_to_id'] = $post->post_author; // Post author ID.
  10. $name = get_the_author_meta( 'display_name', $post->post_author );
  11. $title = $post->post_title;
  12. $permalink = get_permalink( $ID );
  13. $message['message_title'] = sprintf( 'Published: %s', $title );
  14. $message['message_content'] = sprintf ('Congratulations, %s! Your article ā€œ%sā€ has been published.' . 'nn', $name, $title );
  15. $message['message_content'] .= sprintf( 'View: %s', $permalink );
  16. $override = array('post_author' => 1);//change with message sender id
  17.  
  18.  
  19. // Send message
  20. fep_send_message( $message, $override );
  21. }
Add Comment
Please, Sign In to add comment