After upgrading to PHP 7.0 my contact form outputs error

WordPress has a built in function for validating emails and I would advise you use that. So you can replace your preg_match with the wordpress is_email else if (!preg_match(“/^[A-Z0-9.%-]+@[A-Z0-9.%-]+.[A-Z]{2,4}$/”, trim($_POST[’email’]))) { $emailError=”You entered an invalid email address.”; $hasError = true; } REPLACED WITH else if ( ! is_email( trim( $_POST[’email’] ) ) ) { $emailError=”You … Read more

Visitors Contacting Authors

Ive done this before using both contact form 7 and Grunion Contact Form plugins, when using contact form 7 i created a new tag to send the email to the post author: //contact form 7 author email wpcf7_add_shortcode(‘author_email’, ‘wpcf7_expert_email_shortcode_handler’, true); function wpcf7_expert_email_shortcode_handler($tag) { if (!is_array($tag)) return ”; $name = $tag[‘name’]; if (empty($name)) return ”; global … Read more

Transferring contact form input to an email account without using an email-proxy

The CF7 plugin uses WordPress built-in wp_mail() function which itself uses the PHPMailer class (github repo). The PHPMail github documentation states, The PHP mail() function usually sends via a local mail server, typically fronted by a sendmail binary on Linux, BSD and OS X platforms, however, Windows usually doesn’t include a local mail server; PHPMailer’s … Read more

Custom comment type maybe?

I also (ab?)use comments for “private” replies to posts, like product inquiries, suggestions, answers to contests, … The advantage is that they are stored in the database and displayed in the interface without extra code from me (sometimes I add a filter to improve the formatting). Spam filtering and e-mail notifications are easy extras. I … Read more

using 1 form shortcode (si or cf7) for all multisite sites [closed]

A Must Use plugin could do the work. This is just an outline and has to be fully tested: add_shortcode( ‘global_form’, ‘shortcode_wpse_87634’ ); function shortcode_wpse_87634() { // Main site, ID=1, that has the form switch_to_blog( 1 ); // Do your stuff $my_stuff = something(); // maybe do_shortcode // Back to original site restore_current_blog(); // Return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)