Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Forum: Plugins
    In reply to: Pending Review Email Alert

    Check out:
    https://www.dagondesign.com/articles/draft-notification-plugin-for-wordpress/

    In case that goes away:

    <?php
    /*
    Plugin Name: Draft Notification
    Plugin URI: https://www.dagondesign.com/articles/draft-notification-plugin-for-wordpress/
    Description: Sends an email to the site admin when a draft is saved.
    Author: Dagon Design
    Version: 1.21
    Author URI: https://www.dagondesign.com
    */
    
    function dddn_process($id) {
    
    	global $wpdb;
    
    	$tp = $wpdb->prefix;
    
    	$result = $wpdb->get_row("
    		SELECT post_status, post_title, user_login, user_nicename, display_name
    		FROM {$tp}posts, {$tp}users
    		WHERE {$tp}posts.post_author = {$tp}users.ID
    		AND {$tp}posts.ID = '$id'
    	");
    
    	if (($result->post_status == "draft") || ($result->post_status == "pending")) {
    
    		$message = "";
    		$message .= "A draft was updated on '" . get_bloginfo('name') . "'\n\n";
    		$message .= "Title: " . $result->post_title . "\n\n";
    
    			// *** Choose one of the following options to show the author's name
    
    		$message .= "Author: " . $result->display_name . "\n\n";
    		// $message .= "Author: " . $result->user_nicename . "\n\n";
    		// $message .= "Author: " . $result->user_login . "\n\n";
    
    		$message .= "Link: " . get_permalink($id);
    
    		$subject = "Draft Updated on '" . get_bloginfo('name') . "'";
    
    		$recipient = get_bloginfo('admin_email');
    
    		mail($recipient, $subject, $message);
    
    	}
    
    }
    
    add_action('save_post', 'dddn_process');
    
    ?>

    In my case, the error messages were related to the install of the wp-contactform plugin in my WP installation. The plugin appears to be adding a value to the PHP $_POST array during the wp-login.php GET. Why? I assume it’s needed?

    The script /wp-login.php will issue the error messages in question if there is anything in the $_POST array and the userid/pass $_POST values are missing (it thinks the form was submitted w/ one of the required fields blank).

    In my case (WP v2.2.3), I needed to change the following in several locations in wp-login.php. I just made the change, so I’m thinking that corrected it. Will update this message if further problems arise:

    NOTE: use the following at your own risk/gain/demise ?? It worked for me… If you do change anything, make a backup of wp-login.php first, in case you need to revert:

    Ln 92:

    if ( $_POST) {

    changed to:

    if ($_POST[‘log’] || $_POST[‘pwd’]) {

    Ln 297:

    if ( $_POST) {

    changed to:

    if ( $_POST[‘log’] || $_POST[‘pwd’] ) {

    Ln 332:

    if ( $_POST && empty( $user_login ) )

    changed to:

    if ( ($_POST[‘log’] || $_POST[‘pwd’]) && empty( $user_login ) )

    I am interested in this too. I’m going to look at the code, but just wondered if anyone had encountered and/or addressed this.
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)