I’m trying to add two additional options to the form to send a message or an announcement. Namely the following options:
* Send email
* Send SMS message
For this I have done the following:
add_filter( 'fep_form_fields', function( $fields ){
$fields['send_message_sms'] = array(
'type' => 'checkbox',
'value' => '',
'cb_label' => __("Send an sms", 'my_theme' ),
'priority' => 35,
'where' => array( 'newmessage', 'reply', 'shortcode-newmessage', 'new_announcement' ),
);
$fields['send_message_mail'] = array(
'type' => 'checkbox',
'value' => '',
'cb_label' => __("Send an email", 'my_theme' ),
'priority' => 35,
'where' => array( 'newmessage', 'reply', 'shortcode-newmessage', 'new_announcement' ),
);
return $fields;
});
In the function fep_action_message_after_send I can check if a message can be sent or not.
But I have two problems:
- When sending a message, the 2 check boxes are shown. But when I create an announcement, they are not.
- How can I check the value of the checkboxes before the email is sent? To prevent sending if checkbox is not checked.