Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function email_author_about_publishing() {
- global $wpdb, $post_ID, $post_type;
- $users = $wpdb->get_results( "SELECT ID FROM $wpdb->usermeta WHERE meta_key = 'wp_user_level' && meta_value > 0" );
- $post = $wpdb->get_row("SELECT post_author, post_title, post_type FROM $wpdb->posts WHERE ID =" . $post_ID);
- $authordata = get_userdata( $post->post_author );
- $blogname = get_settings( "blogname" );
- $subject = "Your post has been published!";
- $text ="Ciao ". $authordata->user_nicename . ",";
- $text = $text . "\n\nYour post " . $post->post_title." has been published.";
- $text = $text . "\n\nYou can read it here: " . get_permalink( $post_ID );mail( $authordata->user_email,
- $subject,$text,"From: " . $blogname . " <" . get_settings( "admin_email" ) . ">" );}
- if ( $post_type == get_post_type('listing'))
- add_action('publish_post', 'email_author_about_publishing');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement