If somebody wants to know how my solution was:
Call your function in classes/es-register.php, inside the condition if ( isset( $_POST['ed_btn'] )
), at the end. Like that:
if ( isset( $_POST['ed_btn'] ) )
{
check_admin_referer('ed_form_subscribers');
if($ed_name == "YES")
{
$ed_txt_nm = isset($_POST['ed_txt_nm']) ? sanitize_text_field($_POST['ed_txt_nm']) : '';
}
else
{
$ed_txt_nm = "";
}
$ed_txt_em = isset($_POST['ed_txt_em']) ? sanitize_text_field($_POST['ed_txt_em']) : '';
$ed_id = isset($_POST['ed_txt_id']) ? sanitize_text_field($_POST['ed_txt_id']) : '';
if($ed_name == "YES" && $ed_name_mand == "YES" && $ed_txt_nm == "")
{
$ed_alt_nm = '<span class="ed_validation" style="'.ED_MSG_05.'">'.ED_MSG_01.'</span>';
$ed_error = true;
}
if( $ed_txt_nm <> "")
{
$ed_txt_nm = sanitize_text_field($ed_txt_nm);
}
if($ed_txt_em == "")
{
$ed_alt_em = '<span class="ed_validation" style="'.ED_MSG_05.'">'.ED_MSG_01.'</span>';
$ed_error = true;
}
if(!is_email($ed_txt_em) && $ed_txt_em <> "")
{
$ed_alt_em = '<span class="es_af_validation" style="'.ED_MSG_05.'">'.ED_MSG_02.'</span>';
$ed_error = true;
}
if($ed_id == "group-option")
{
$ed_id = isset($_POST['ed_txt_group']) ? sanitize_text_field($_POST['ed_txt_group']) : '';
}
if($ed_id == "" || $ed_id == "group-option")
{
$ed_alt_gp = '<span class="ed_validation" style="'.ED_MSG_05.'">'.ED_MSG_07.'</span>';
$ed_error = true;
}
if(!$ed_error)
{
//Success
$homeurl = home_url();
$samedomain = strpos($_SERVER['HTTP_REFERER'], $homeurl);
if (($samedomain !== false) && $samedomain < 5)
{
$sts = ed_cls_subscribers::ed_subscriber_create($ed_txt_nm, $ed_txt_em, $ed_id);
if($sts == "suss")
{
$ed_email_id = ed_cls_subscribers::ed_subscriber_foremail($ed_txt_em, $ed_id);
if($ed_email_id > 0)
{
$ed_email_id = ed_cls_sendemail::ed_sendemail_prepare($ed_email_id);
}
$ed_alt_success = '<span class="ed_sent_successfully" style="'.ED_MSG_06.'">'.ED_MSG_04.'</span>';
}
}
//Implement your function here and use the email if you want
myMailchimpAPICall($ed_txt_em);
}
}