To or Cc multiple wordpress contacts via filtered db query
-
i want to send email to multiple contacts via db query. i was trying to do so using Contact Form 7. i’d like to save myself hours of trial and error coding. okay 2 things at issue: 1.) the Contact Form 7 validation won’t allow multiple email address. 2.) i don’t need multiple “From:” headers. i need multiple “To:”, or “Cc:”. That’s my fault for being stupid.
<?php if (current_user_can('edit_users')) { $email_array = array(); $email_concat = ''; $userlogin_array = array(); $userlogin_concat = ''; foreach ($bulk_user_ids as $user_id) { $user = get_user_by('id', $user_id); $email_concat .= $user->user_email .','; $userlogin_concat .= $user->user_login .', '; } ?> <form action="users.php" method="post" class="wpcf7-form init" aria-label="Contact form" novalidate="novalidate" data-status="init"> <input size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" autocomplete="name" aria-required="true" aria-invalid="false" value="<?php echo $userlogin_concat; ?>" type="text" name="your-name"> </p> <p><label>Your email<br> <input size="40" class="wpcf7-form-control wpcf7-text wpcf7-email " value="<?php echo $email_concat; ?>" type="email" name="your-email">
I was expecting to learn what happens when this code is executed. It results in error. I suppose it’s javascript validation. Then I realize I’m using the wrong field anyway. Before I start over, I’d like to know if anyone has a recommended solution.
I was advised to place some code in a functions.php file, but that seems like bad advice. What if change themes?
- The topic ‘To or Cc multiple wordpress contacts via filtered db query’ is closed to new replies.