Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. function email_author_about_publishing() {
  3. global $wpdb, $post_ID, $post_type;
  4.  
  5. $users = $wpdb->get_results( "SELECT ID FROM $wpdb->usermeta WHERE meta_key = 'wp_user_level' && meta_value > 0" );
  6. $post = $wpdb->get_row("SELECT post_author, post_title, post_type FROM $wpdb->posts WHERE ID =" . $post_ID);
  7.  
  8. $authordata = get_userdata( $post->post_author );
  9.  
  10. $blogname = get_settings( "blogname" );
  11. $subject = "Your post has been published!";
  12.  
  13. $text ="Ciao ". $authordata->user_nicename . ",";
  14. $text = $text . "\n\nYour post " . $post->post_title." has been published.";
  15. $text = $text . "\n\nYou can read it here: " . get_permalink( $post_ID );mail( $authordata->user_email,
  16. $subject,$text,"From: " . $blogname . " <" . get_settings( "admin_email" ) . ">" );}
  17.  
  18. if ( $post_type == get_post_type('listing'))
  19.  
  20. add_action('publish_post', 'email_author_about_publishing');
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement