Replies: 2
Hi there,
I have a form where the site visitors can create a user. Under certain conditions, we need to manually approve the user, but in other cases they should be approved automatically. I have the code below that is based on the forum post here. If I debug line by line, the line with “activate_signup” is run on form submission. However, the user is not approved/activated. Is something changed in the plugin so it does not work anymore?
//Aktiverer automatisk privatkunder
add_action('forminator_custom_form_submit_before_set_fields', function($entry){
add_action('forminator_form_after_save_entry', function($form_id) use ($entry){
if ($form_id == 83969){
$form_model = Forminator_Form_Model::model()->load($form_id);
foreach ($form_model->fields as $field){
if ('select-2' === $field->slug){
$kundetype = $entry->get_meta($field->slug);
if ($kundetype == 'Privatkunde'){
$activation_key = $entry->get_meta('activation_key');
if (false !== $activation_key){
Forminator_CForm_User_Signups::activate_signup($activation_key, true);
}
break;
}
}
}
}
});
});