Plugin Directory

Changeset 1853642


Ignore:
Timestamp:
04/05/2018 06:48:34 PM (8 years ago)
Author:
TouchOfTech
Message:

moved version 1.5 to tags

Location:
draft-notify/tags
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • draft-notify/tags/V1.0/draft-notify.php

    r680651 r1853642  
    6060            if($canEmail)
    6161            {
    62         $message = "A draft was created: '" . get_bloginfo('name') . "'\n";
     62                $message = get_option('draftnotifycustomheader');
     63        $message .= "A draft was created: '" . get_bloginfo('name') . "'\n";
    6364        $message .= "Post Title: " . $result->post_title . "\n";
    6465        $message .= "Author's Username: " . $result->user_login . "\n";
    6566
     67                $message = get_option('draftnotifycustomfooter');
    6668        //$message .= var_export($result, true);
    6769
     
    8486        }
    8587       
    86         mail($recipient, $subject, $message);
     88                $headers = "";
     89                if(get_option('draftnotifyfromaddress')!="")
     90                {
     91                    $headers .= "From: ".get_option('draftnotifyfromaddress')."\r\n";
     92                }
     93                if(get_option('draftnotifyreplytoaddress')!="")
     94                {
     95                    $headers .= "Reply-to: ".get_option('draftnotifyreplytoaddress')."\r\n";
     96                }
     97               
     98               
     99        mail($recipient, $subject, $message, $headers);
    87100           
    88101                if(!in_array($id, $emailedEx))
     
    118131register_setting( 'draftnotify_options', 'draftnotifyemailrevisions' );
    119132register_setting( 'draftnotify_options', 'draftnotifyemailedlist' );
     133register_setting( 'draftnotify_options', 'draftnotifyposttypes1' );
     134register_setting( 'draftnotify_options', 'draftnotifyposttypes2' );
     135register_setting( 'draftnotify_options', 'draftnotifycustomheader' );
     136register_setting( 'draftnotify_options', 'draftnotifycustomfooter' );
     137register_setting( 'draftnotify_options', 'draftnotifyfromaddress' );
     138register_setting( 'draftnotify_options', 'draftnotifyreplytoaddress' );
    120139}
    121140
     
    159178</tr>
    160179<tr>
     180<td valign='top'><b>Send to 1 Admin:</b></td>
     181<td valign='top'>";
     182
     183// create a dynmaic list based on the admin roles.
     184
     185$savedSelectVal = get_option('draftnotifyalevel'); 
     186$temp =(strlen($savedSelectVal) == 0 || $savedSelectVal < 0)?" selected='selected'":"";
     187
     188$tempArr = get_editable_roles();
     189
     190foreach($tempArr as $role=>$roleArr)
     191{
     192    $tempLevel = getTempLevel($roleArr['capabilities']);
     193    $temp =($savedSelectVal==$tempLevel)?" selected='selected'":"";
     194    echo "{$role}";
     195}
     196   
     197echo "</select></td>
     198<td valign='top'>Admin Accounts are listed here.  Select those accounts which should be emailed.  These will be added to the list of emails you entered above and ignored if you select a whole user group to email.</td>
     199</tr>";
     200
     201// Post Type
     202echo "<tr>
     203<td valign='top'><b>Send Emails for These types of articles:</b></td>
     204<td valign='top'>";
     205$savedSelectVal = get_option('draftnotifyposttypes1');
     206$checked = ($savedSelectVal == "page")?" checked":"";
     207echo "<input type='checkbox' id='draftnotifypageselection' name='draftnotifypageselection' value='page'{$checked}><label for='draftnotifypageselection'>Pages</label>";
     208$savedSelectVal = get_option('draftnotifyposttypes2');
     209$checked = ($savedSelectVal == "post")?" checked":"";
     210echo "<input type='checkbox' id='draftnotifypostselection' name='draftnotifypostselection' value='post'{$checked}><label for='draftnotifypostselection'>Posts</label>";
     211
     212
     213echo "</td>
     214<td valign='top'>Choose the types of artiles you want emails for.</td>
     215</tr>";
     216
     217// Revisions.
     218echo "<tr>
    161219<td valign='top'><b>Send Emails when revisions are made:</b></td>
    162220<td valign='top'><select id='draftnotifyemailrevisions' name='draftnotifyemailrevisions' > ";
     
    168226</select></td>
    169227<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>";
     228</tr>";
     229   
     230    // From Address
     231echo "<tr>
     232<td valign='top'><b>Custom From Address:</b></td>
     233<td valign='top'><input id='draftnotifyfromemail' name='draftnotifyfromemail' size='40' type='text' value='".get_option('draftnotifyfromaddress')."' />
     234<td valign='top'>Please enter an email address to appear as the sent from address of the email.</td>
     235</td></tr>";
     236    // Reply To
     237echo "<tr>
     238<td valign='top'><b>Custom Reply-To Address:</b></td>
     239<td valign='top'><input id='draftnotifyreplyto' name='draftnotifyreplyto' size='40' type='text' value='".get_option('draftnotifyreplytoaddress')."' />
     240<td valign='top'>Please enter an email address to be put in the reply-to field of the email.</td>
     241</td></tr>";
     242   
     243    // Header
     244echo "<tr>
     245<td valign='top'><b>Custom Header text:</b></td>
     246<td valign='top'><textarea id='draftnotifyheader' name='draftnotifyheader' rows='3' cols='75'>".get_option('draftnotifycustomheader')."</textarea>
     247<td valign='top'>Text to be placed at the beginning of every email.</td>
     248</td></tr>";
     249   
     250  // Footer
     251echo "<tr>
     252<td valign='top'><b>Custom Footer text:</b></td>
     253<td valign='top'><textarea id='draftnotifyfooter' name='draftnotifyfooter' rows='3' cols='75'>".get_option('draftnotifycustomfooter')."</textarea>
     254<td valign='top'>Text to be placed at the end of every email.</td>
     255</td></tr>";
     256   
     257echo "</table>";
    172258
    173259 submit_button();
Note: See TracChangeset for help on using the changeset viewer.