Changeset 680651
- Timestamp:
- 03/12/2013 05:38:57 PM (13 years ago)
- Location:
- draft-notify
- Files:
-
- 1 added
- 2 edited
- 2 copied
-
tags/V1.0 (added)
-
tags/V1.0/draft-notify.php (copied) (copied from draft-notify/trunk/draft-notify.php)
-
tags/V1.0/readme.txt (copied) (copied from draft-notify/trunk/readme.txt)
-
trunk/draft-notify.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
draft-notify/trunk/draft-notify.php
r677289 r680651 5 5 Description: When an author saves a post, it sends out an email based on the settings. Either to a single email address, or to all users above a certain access level. You can also select whether or not to send emails for revisions. 6 6 Author: Andrew Hallman 7 Version: 1. 07 Version: 1.2 8 8 Author URI: http://www.touchoftechnology.com 9 9 */ … … 22 22 $emailForRevisions = get_option('draftnotifyemailrevisions'); 23 23 24 // Author's first and last name are found in the metadata table. 24 25 $result = $wpdb->get_row(" 25 SELECT post_status, post_title, user_login, display_name 26 FROM {$prefix}posts, {$prefix}users 26 SELECT post_status, post_title, post_modified, 27 user_login, display_name, user_email, 28 {$prefix}usermeta.meta_value as fname, 29 meta2.meta_value as lname 30 FROM {$prefix}posts, {$prefix}users 31 LEFT JOIN ({$prefix}usermeta) ON 32 ({$prefix}usermeta.user_id = {$prefix}users.ID AND 33 {$prefix}usermeta.meta_key = 'first_name' ) 34 LEFT JOIN ({$prefix}usermeta as meta2) ON 35 (meta2.user_id = {$prefix}users.ID AND 36 meta2.meta_key = 'last_name' ) 27 37 WHERE {$prefix}posts.post_author = {$prefix}users.ID AND {$prefix}posts.ID = '$id' "); 28 38 … … 48 58 49 59 // also do the manual check for the autosave of the first draft. 50 // settings_fields('draftnotify_options');51 // do_settings_sections('draftnotify_options');52 60 $alreadyEmailedList = get_option('draftnotifyemailedlist'); 53 61 $emailedEx = explode("|", $alreadyEmailedList); … … 60 68 if($canEmail) 61 69 { 62 $message = "A draft was created: '" . get_bloginfo('name') . "'\n"; 63 $message .= "Post Title: " . $result->post_title . "\n"; 64 $message .= "Author's Username: " . $result->user_login . "\n"; 65 66 //$message .= var_export($result, true); 67 70 $message = "A draft was created: '" . get_bloginfo('name') . "'\n<br>"; 71 $message .= "Post Title: " . $result->post_title . "\n<br>"; 72 $message .= "Post Modified: " . $result->post_modified . "\n<br>"; 73 $message .= "Author's Username: " . $result->user_login . "\n<br>"; 74 75 76 $savedEmailPostLinkVal = get_option('draftnotifyemailpostlink'); 77 $savedEmailAuthorNameVal = get_option('draftnotifyemailauthorname'); 78 $savedEmailAuthorEmailAddressVal = get_option('draftnotifyemailauthoremail'); 79 80 if($savedEmailAuthorNameVal) 81 { 82 $message .= "Author's Real Name: {$result->fname} {$result->lname }\n<br>"; 83 } 84 85 86 if($savedEmailAuthorEmailAddressVal) 87 { 88 $message .= "Author's Email Address: " . $result->user_email . "\n<br>"; 89 } 90 91 if($savedEmailPostLinkVal) 92 { 93 $message .= "\n<br>Link to Pending Posts: <a href='" . home_url('/') . "wp-admin/edit.php?post_status=pending&post_type=post' target='_blank'>here</a>\n<br>"; 94 } 95 68 96 $subject = "Draft on '" . get_bloginfo('name') . "'"; 69 97 … … 84 112 } 85 113 86 mail($recipient, $subject, $message); 114 $headers = 'MIME-Version: 1.0' . "\r\n"; 115 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 116 mail($recipient, $subject, $message, $headers); 87 117 88 118 if(!in_array($id, $emailedEx)) … … 118 148 register_setting( 'draftnotify_options', 'draftnotifyemailrevisions' ); 119 149 register_setting( 'draftnotify_options', 'draftnotifyemailedlist' ); 150 register_setting( 'draftnotify_options', 'draftnotifyemailpostlink' ); 151 register_setting( 'draftnotify_options', 'draftnotifyemailauthorname' ); 152 register_setting( 'draftnotify_options', 'draftnotifyemailauthoremail' ); 120 153 } 121 154 … … 168 201 </select></td> 169 202 <td valign='top'>If you would like an email every time someones saves a revision to the draft, select Yes, otherwise, select NO and you'll only get an email the first time the draft is saved.</td> 170 </tr> 171 </table>"; 203 </tr>"; 204 205 echo"<tr><td colspan='3'><h3>Email Format Options</h3></td></tr>"; 206 $savedEmailPostLinkVal = get_option('draftnotifyemailpostlink'); 207 $savedEmailAuthorNameVal = get_option('draftnotifyemailauthorname'); 208 $savedEmailAuthorEmailAddressVal = get_option('draftnotifyemailauthoremail'); 209 210 $checked = ($savedEmailPostLinkVal)?" checked='checked' ":""; 211 echo"<tr> 212 <td valign='top'><b>Include Link to Posts in Email:</b></td> 213 <td valign='top'><input id='draftnotifyemailpostlink' name='draftnotifyemailpostlink' type='checkbox' {$checked}> Check to send</td> 214 <td valign='top'> </td> 215 </tr>"; 216 217 $checked = ($savedEmailAuthorNameVal)?" checked='checked' ":""; 218 echo"<tr> 219 <td valign='top'><b>Include Author's Real Name in Email:</b></td> 220 <td valign='top'><input id='draftnotifyemailauthorname' name='draftnotifyemailauthorname' type='checkbox' {$checked}> Check to send</td> 221 <td valign='top'> </td> 222 </tr>"; 223 224 $checked = ($savedEmailAuthorEmailAddressVal)?" checked='checked' ":""; 225 echo"<tr> 226 <td valign='top'><b>Include Author's Email Address in Email:</b></td> 227 <td valign='top'><input id='draftnotifyemailauthoremail' name='draftnotifyemailauthoremail' type='checkbox' {$checked}> Check to send</td> 228 <td valign='top'> </td> 229 </tr>"; 230 231 echo "</table>"; 172 232 173 233 submit_button(); -
draft-notify/trunk/readme.txt
r677289 r680651 13 13 == Description == 14 14 15 I run multiple blogs and have the ability for people to sign up and write content for me. I was disappointed that WordPress does not have anything built it to alert me with an email notification when a new author writes something. I don t log into the sites unless I have to, so new content may sit for a while without being noticed. I did find 1 plugin that would accomplish the email, but it was buggy. So Ive written my own and am willing to share it with you. Specifically this plugin is designed to email you when an author saves a draft. Now there are some additional settings, but check them out below. As always, suggestions are welcome, just leave them in the comments along with any bugs you might encounter.15 I run multiple blogs and have the ability for people to sign up and write content for me. I was disappointed that WordPress does not have anything built it to alert me with an email notification when a new author writes something. I don�t log into the sites unless I have to, so new content may sit for a while without being noticed. I did find 1 plugin that would accomplish the email, but it was buggy. So I�ve written my own and am willing to share it with you. Specifically this plugin is designed to email you when an author saves a draft. Now there are some additional settings, but check them out below. As always, suggestions are welcome, just leave them in the comments along with any bugs you might encounter. 16 16 17 17 = Draft Notify Features = … … 38 38 39 39 == Changelog == 40 = 1.2 = 41 * Added a few options into the settings page that customize the email you receive. 40 42 41 43 = 1.1 =
Note: See TracChangeset
for help on using the changeset viewer.