$value){ $_POST[$name] = stripslashes($value); } $galaxy_review_form_error=''; $galaxy_review_form_success=''; if($_POST['galaxy-review-name']==''||$_POST['galaxy-review-email']==''||$_POST['galaxy-review-state']==''||$_POST['galaxy-review-rating']=='' ||$_POST['galaxy-review-title']==''||$_POST['galaxy-review-message']==''||$_POST['galaxy-captcha-solve']==''){ $galaxy_review_form_error='
Please enter in all required fields.
'; } elseif(!is_email($_POST['galaxy-review-email'])){ $galaxy_review_form_error='
Please enter a valid email address.
'; } elseif($_POST['galaxy-captcha-solve']!=$_POST['galaxy-captcha-pose']){ $galaxy_review_form_error='
The verification code entered is incorrect.
'; } elseif($_POST['galaxy-review-rating']=='0'){ $galaxy_review_form_error='
Please enter a rating from 1 to 5.
'; } $galaxy_review_name = sanitize_text_field($_POST['galaxy-review-name']); $galaxy_review_email = sanitize_text_field($_POST['galaxy-review-email']); $galaxy_review_state = sanitize_text_field($_POST['galaxy-review-state']); $galaxy_review_rating = sanitize_text_field($_POST['galaxy-review-rating']); $galaxy_review_title = sanitize_text_field($_POST['galaxy-review-title']); $galaxy_review_message = sanitize_text_field($_POST['galaxy-review-message']); $ip=$_SERVER['REMOTE_ADDR']; if($galaxy_review_form_error!=''){ $galaxy_review_form_display='block;'; $galaxy_activate_form_display='none;'; } else{ $post=array( 'post_type' => 'reviews', 'post_title' => $galaxy_review_title, 'post_name' => sanitize_title_for_query($galaxy_review_title), 'post_status' => 'draft', 'ping_status' => 'closed', 'post_date' => date('Y-m-d H:i:s'), 'post_date' => gmdate('Y-m-d H:i:s'), 'post_author' => '1', 'post_content' => $galaxy_review_message ); $postId = wp_insert_post($post); if($postId!=false){ add_post_meta($postId, 'rating', $galaxy_review_rating); add_post_meta($postId, 'ip-address', $ip); add_post_meta($postId, 'patient-name', $galaxy_review_name); add_post_meta($postId, 'patient-email', $galaxy_review_email); add_post_meta($postId, 'patient-location', $galaxy_review_state); } $message="

A new review has been posted at ".get_bloginfo('sitename').". This will be saved as a draft in the Successes section of WordPress. To approve the review, simply log into WordPress and publish the post. See the review below:


From: {$_POST['galaxy-review-name']}
Email: {$_POST['galaxy-review-email']}
Location: {$_POST['galaxy-review-state']}
Rating Given (From 1-5): {$_POST['galaxy-review-rating']}

Review Title: {$_POST['galaxy-review-title']}

"; $message.=nl2br("

{$_POST['galaxy-review-message']}

"); $message.="

IP Address: $ip

"; add_filter( 'wp_mail_content_type', 'set_html_content_type' ); $headers[]='From: '.$_POST['galaxy-review-name'].' <'.$_POST['galaxy-review-email'].'>'; wp_mail(get_bloginfo('admin_email'),'New Review Submission Pending Approval On '.get_bloginfo('sitename'),$message, $headers); remove_filter( 'wp_mail_content_type', 'set_html_content_type' ); $galaxy_review_form_success='
Thank you for your feedback!
'; $galaxy_review_name = ''; $galaxy_review_email = ''; $galaxy_review_state = ''; $galaxy_review_rating = ''; $galaxy_review_title = ''; $galaxy_review_message = ''; } } ?>