0

I am working on doubt solving WordPress theme here user posts their problems and mentor solve them but the issue is here users are only allowed to share the link where they want to receive solutions I want users to share their email as well if they want to receive solutions over the email but whenever put their email the function took their domain part and show as a link on the post.

What I am trying to implement here is the function auto-detect if the user put their email it adds mailto before the email and post like this mailto:someone@example.com.

function glat_save_new_problem() {
                      check_ajax_referer('company_new_job_ajax_nonce', 'security');
        $location =   isset($_POST['location'])
                    ? sanitize_text_field($_POST['location'])
                    : '';
        $valid =    isset($_POST['valid'])
                    ? sanitize_text_field($_POST['valid'])
                    : '';
        $action =   isset($_POST['btn_action'])
                    ? sanitize_text_field($_POST['btn_action']) 
}

Please help me to resolve it

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
  • 1
    Are you trying to [determine if a string is an email address](https://stackoverflow.com/a/12026863/231316)? – Chris Haas Apr 17 '23 at 18:01
  • there are these lines regarding the External URL: `$action = isset($_POST['btn_action']) ? sanitize_text_field($_POST['btn_action']) : '';` As you can see it is sanitized as text, and there is no other filter or URL validation. – Abhiupadhyay Apr 20 '23 at 19:08

0 Answers0