new articles are published and contact form 7 combine.

// alerts as new articles are published and contact form 7 combine.
function qd_notifyauthor_postcontact($post_id) {

global $wpdb,$wpcf7s_posted_data;

//$submission = WPCF7_Submission::get_instance();

$tablename = $wpdb->prefix.’cf7dbplugin_submits’;

$result = $wpdb->get_results(“select * from “.$tablename.” LIMIT 0,100″);

//echo “<pre>”; print_r($result); exit;
$demo = array();
foreach($result as $results)
{
$submit_time = $results->submit_time;
$form_name = $results->form_name;
$field_name = $results->field_name;
$field_value = $results->field_value;
$field_order = $results->field_order;
$demo[$submit_time][$field_name] = $field_value;
}
$demo = array_values($demo);
//echo “<pre>”; print_r($demo);
$email_str =”;
if(is_array($demo) && !empty($demo))
{
for($i=0;$i<count($demo);$i++)
{
if($demo[$i][’email’]!=” && trim($demo[$i][‘articles_subscribe’])!=”)
{
//Mail Functionshere
//qd_notifyauthor($demo[$i][’email’],trim($demo[$i][‘articles_subscribe’]))
$email_str .= $demo[$i][’email’].’,’;
//exit;
}
}
if($email_str!=”)
{
$email_str= substr($email_str,0,-1);
//qd_notifyauthortest($post_id,$email_str);
}
}

$email_str .= $email_str;

$post = get_post($post_id);
$author = $email_str;
$author = $author;

$subject = “ARTICLES: “.$post->post_title.””;

$message = ”
Hi “.$author->display_name.”,

Your post, \””.$post->post_title.”\” has just been published.

View post: “.get_permalink( $post_id ).”

Thanks”;

wp_mail($author, $subject, $message);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.