show_errors(); $table_name = $wpdb->prefix . 'visitors_edits'; $post_id=$_POST["post_id"]; $visitor_name=$_POST["visitor_name"]; $visitor_email=$_POST["visitor_email"]; $visitor_comment=$_POST["visitor_comment"]; $edit_content=$_POST["edit_content"]; $post = get_post($post_id); //Check if changed if(md5($post->post_content)!==md5(stripcslashes($edit_content))){ $wpdb->insert($table_name,[ "edit_time"=>date('Y-m-d H:i:s'), "visitor_name"=>$visitor_name, "visitor_email"=>$visitor_email, "visitor_comment"=>$visitor_comment, "edit_content"=>$edit_content, "post_id"=>$post_id, "post_content"=>$post->post_content ]); require "mail.php"; $options=get_option( "visitors_edits_options", [ "admin_email"=>"", "notify_admin"=>null, "visitor_notif_message"=>"Your suggestion was submitted.", "admin_notif_message"=>"A new suggestion was submitted." ]); $mail = [ "post_title"=>$post->post_title, "post_url"=>get_permalink($post_id), "visitor_name"=>$visitor_name, "visitor_email"=>$visitor_email, "edit_time"=>date('H:i')." - ".date('d/m/y'), "blog_title" => get_bloginfo("name"), "visitor_notif_message"=>$options["visitor_notif_message"], "admin_notif_message"=>$options["admin_notif_message"] ]; $visitor_submitionMail=new visitors_edits_EMAIL($mail,"visitor_submition"); $visitor_submitionMail->send($visitor_email); if($options["notify_admin"]!=null){ $admin_email=$options["admin_email"]; $admin_submitionMail=new visitors_edits_EMAIL($mail,"admin_submition"); $admin_submitionMail->send($admin_email); } } }else{ global $wp; global $post; $post = get_posts([ "name"=> $wp->query_vars['visitors_edits_post_name'], 'post_type' => 'post', 'post_status' => 'publish', 'numberposts' => 1 ]); $post=$post[0]; if($post->post_name!=$wp->query_vars['visitors_edits_post_name']){ header("Location:".get_site_url()); } } ?> Submit an edit >
Submit a contribution

Original post : post_title; ?>.

post_content,"edit_content",[ "media_buttons"=>false, "quicktags"=>false, "textarea_name"=>"edit_content", "tinymce"=>[ "mode" => "textareas", "theme" => "modern" ] ]); _WP_Editors::enqueue_scripts(); print_footer_scripts(); _WP_Editors::editor_js(); ?>