// send EDITED ad notification email to admin
function cp_edited_ad_email($post_id) {
// get the post values
$the_ad = get_post($post_id);
$category = appthemes_get_custom_taxonomy($post_id, 'ad_cat', 'name');
$ad_title = stripslashes($the_ad->post_title);
$ad_cat = stripslashes($category);
$ad_author = stripslashes(get_the_author_meta('user_login', $the_ad->post_author));
$ad_slug = stripslashes($the_ad->guid);
//$ad_content = appthemes_filter(stripslashes($the_ad->post_content));
$adminurl = get_option('siteurl').'/wp-admin/post.php?action=edit&post='.$post_id;
$mailto = get_option('admin_email');
// $mailto = 'tester@127.0.0.1'; // USED FOR TESTING
$subject = __('Edited Ad Awaiting Moderation','appthemes');
$headers = 'From: '. __('ClassiPress Admin', 'appthemes') .' <'. get_option('admin_email') .'>' . "\r\n";
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$message = __('Dear Admin,', 'appthemes') . "\r\n\r\n";
$message .= sprintf(__('The following ad listing has just been edited on your %s website.', 'appthemes'), $blogname) . "\r\n\r\n";
$message .= __('Ad Details', 'appthemes') . "\r\n";
$message .= __('-----------------') . "\r\n";
$message .= __('Title: ', 'appthemes') . $ad_title . "\r\n";
$message .= __('Category: ', 'appthemes') . $ad_cat . "\r\n";
$message .= __('Author: ', 'appthemes') . $ad_author . "\r\n";
//$message .= __('Description: ', 'appthemes') . $ad_content . "\r\n";
$message .= __('-----------------') . "\r\n\r\n";
$message .= __('Preview Ad: ', 'appthemes') . $ad_slug . "\r\n";
$message .= sprintf(__('Edit Ad: %s', 'appthemes'), $adminurl) . "\r\n\r\n\r\n";
$message .= __('Regards,', 'appthemes') . "\r\n\r\n";
$message .= __('ClassiPress', 'appthemes') . "\r\n\r\n";
// ok let's send the email
wp_mail($mailto, $subject, $message, $headers);
}
// send EDITED ad MODERATION email to ad owner
function cp_owner_edited_ad_email($post_id) {
// get the post values
$the_ad = get_post($post_id);
$category = appthemes_get_custom_taxonomy($post_id, 'ad_cat', 'name');
$ad_title = stripslashes($the_ad->post_title);
$ad_cat = stripslashes($category);
$ad_author = stripslashes(get_the_author_meta('user_login', $the_ad->post_author));
$ad_author_email = stripslashes(get_the_author_meta('user_email', $the_ad->post_author));
$ad_status = stripslashes($the_ad->post_status);
//$ad_content = appthemes_filter(stripslashes($the_ad->post_content));
$siteurl = trailingsla****(get_option('home'));
$dashurl = trailingsla****(CP_DASHBOARD_URL);
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$mailto = $ad_author_email;
//$mailto = 'tester@127.0.0.1'; // USED FOR TESTING
$subject = sprintf(__('Your Ad Submission on %s','appthemes'), $blogname);
$headers = 'From: '. sprintf(__('%s Admin', 'appthemes'), $blogname) .' <'. get_option('admin_email') .'>' . "\r\n";
$message = sprintf(__('Hi %s,', 'appthemes'), $ad_author) . "\r\n\r\n";
$message .= sprintf(__('Your update listing is being processed and is now held in pending status until reviewed by site admin.', 'appthemes'), $blogname) . "\r\n\r\n";
$message .= __('Ad Details', 'appthemes') . "\r\n";
$message .= __('-----------------') . "\r\n";
$message .= __('Title: ', 'appthemes') . $ad_title . "\r\n";
$message .= __('Category: ', 'appthemes') . $ad_cat . "\r\n";
$message .= __('Status: ', 'appthemes') . $ad_status . "\r\n";
//$message .= __('Description: ', 'appthemes') . $ad_content . "\r\n";
$message .= __('-----------------') . "\r\n\r\n";
$message .= __('You may check the status of your ad(s) at anytime by logging into your dashboard.', 'appthemes') . "\r\n";
$message .= $dashurl . "\r\n\r\n\r\n\r\n";
$message .= __('Regards,', 'appthemes') . "\r\n\r\n";
$message .= sprintf(__('Your %s Team', 'appthemes'), $blogname) . "\r\n";
$message .= $siteurl . "\r\n\r\n\r\n\r\n";
// ok let's send the email
wp_mail($mailto, $subject, $message, $headers);
}
// put all the ad elements into an array
// these are the minimum required fields for WP (except tags)
$update_ad = array();
$update_ad['ID'] = trim($_POST['ad_id']);
$update_ad['post_title'] = appthemes_filter($_POST['post_title']);
$update_ad['post_content'] = trim($post_content);
$update_ad['tags_input'] = $new_tags; // array
// put all the ad elements into an array
if(current_user_can( 'contributor' )) {
// these are the minimum required fields for WP (except tags)
$update_ad = array();
$update_ad['ID'] = trim($_POST['ad_id']);
$update_ad['post_title'] = appthemes_filter($_POST['post_title']);
$update_ad['post_content'] = trim($post_content);
$update_ad['post_status'] = ( 'pending' );
$update_ad['tags_input'] = $new_tags; // array
//$update_ad['post_category'] = array((int)appthemes_filter($_POST['cat'])); // maybe use later if we decide to let users change categories
} else {
$update_ad = array();
$update_ad['ID'] = trim($_POST['ad_id']);
$update_ad['post_title'] = appthemes_filter($_POST['post_title']);
$update_ad['post_content'] = trim($post_content);
$update_ad['tags_input'] = $new_tags; // array
}
$errmsg = '<div class="box-yellow"><b>' . __('Your ad has been successfully updated.','appthemes') . '</b> <a href="' . CP_DASHBOARD_URL . '">' . __('Return to my dashboard','appthemes') . '</a></div>';
$errmsg = '<div class="box-yellow"><b>' . __('Your ad has been updated and is held for manual review.','appthemes') . '</b> <a href="' . CP_DASHBOARD_URL . '">' . __('Return to my dashboard','appthemes') . '</a></div>';
cp_owner_edited_ad_email($post_id);
cp_edited_ad_email($post_id);
kate_b (April 25th, 2011)
There are currently 1 users browsing this thread. (0 members and 1 guests)