[wp-cvs] wordpress wp-mail.php,1.20,1.21

Matthew Mullenweg saxmatt at users.sourceforge.net
Wed Sep 8 08:57:54 UTC 2004


Update of /cvsroot/cafelog/wordpress
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7794

Modified Files:
	wp-mail.php 
Log Message:
Have WP mailed post come from author if email matches author in DB. Hat tip:  Jerome Cornet.

Index: wp-mail.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-mail.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** wp-mail.php	5 Sep 2004 02:03:51 -0000	1.20
--- wp-mail.php	8 Sep 2004 08:57:52 -0000	1.21
***************
*** 66,69 ****
--- 66,85 ----
  				$subject = $subject[0];
  			}
+ 
+ 			// Set the author using the email address (To or Reply-To, the last used)
+ 			// otherwise use the site admin
+ 			if (preg_match('/From: /', $line) | preg_match('Reply-To: /', $line))  {
+ 				$author=trim($line);
+ 			if ( ereg("([a-zA-Z0-9\_\-\.]+@[\a-zA-z0-9\_\-\.]+)", $author , $regs) ) {
+ 				echo "Author = {$regs[1]} <p>";
+ 				$result = $wpdb->get_row("SELECT ID FROM $tableusers WHERE user_email='$regs[1]' ORDER BY ID DESC LIMIT 1");
+ 				if (!$result)
+ 					$post_author = 1;
+ 				else
+ 					$post_author = $result->ID;
+ 			} else
+ 				$post_author = 1;
+ 			}
+ 
  			if (preg_match('/Date: /i', $line)) { // of the form '20 Mar 2002 20:32:37'
  				$ddate = trim($line);
***************
*** 131,134 ****
--- 147,151 ----
  	do_action('publish_phone', $post_ID);
  
+ 	echo "\n<p><b>Author:</b> $post_author</p>";
  	echo "\n<p><b>Posted title:</b> $post_title<br />";
  	echo "\n<b>Posted content:</b><br /><pre>".$content.'</pre></p>';




More information about the cvs mailing list