Jump to content

dmsman

New Members
  • Posts

    2
  • Joined

  • Last visited

dmsman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I should have mentioned that I don't know how to code PHP. Formidable Forms provided the original PHP code which I tweaked to work my specific forms. @kicken, I like what you're saying however I don't know what code to write. If this requires a paid project, I'm happy to do that however I need guidance and almost copy-and-paste code.
  2. I need to use PHP on my WordPress site to restrict who can submit a specific form. I only want to allow those using a specific email domain to be able to submit a form. Below is the code I am using. The code works. The issue is I have 400+ domains that I need to whitelist. I am hoping to use an array but I don't know if this is the best way. Bottom line is I am hoping someone can help adjust the code below to show me how to add additional domains. In the code below, the only domain currently whitelisted is example.com. add_filter('frm_validate_field_entry', 'check_valid_email', 10, 3); function check_valid_email($errors, $posted_field, $posted_value){ if($posted_field->id == 7){ $postedemail=$_POST['item_meta'][7]; $alloweddomain = explode('@',$postedemail)[1]; if (!filter_var($postedemail, FILTER_VALIDATE_EMAIL) || $alloweddomain != 'example.com') { $errors['field'. $posted_field->id] = 'Sorry! You are not allowed to submit this form'; } } return $errors; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.