Home › Forums › Front End PM PRO › Extra setting send mail / sms
Tagged: announcement, checkbox, mails, settings
- This topic has 7 replies, 2 voices, and was last updated 7 years, 3 months ago by Shamim Hasan.
- AuthorPosts
- September 16, 2018 at 8:56 pm #17467test programmerParticipant
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 messageFor 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.
September 16, 2018 at 10:08 pm #17473Shamim HasanKeymasterWhich version of the plugin you are using? are you trying to add announcement from front-end?
You can usefep_action_validate_formhook to check if those are checked and if not you can add an error which will prevent message/announcement sending.September 17, 2018 at 12:42 am #17476test programmerParticipantI’m using version 8.4.1. I’m trying to add an announcement in the backend. How can I make sure the checkboxes are added?
September 17, 2018 at 1:33 am #17478test programmerParticipantI also don’t want to show an error, I want to prevent email sending. How can I do that?
September 17, 2018 at 9:42 am #17481Shamim HasanKeymasterIt is always recommended to use latest version. If possible, update to latest version.
In your version, you can use add_meta_box to show checkbox in announcement add page.
to prevent email sending you can use
update_post_meta( $message_id, '_fep_email_sent', time() );in your save function.Again, if possible, update to latest version so that you can easily achieve this. I can provide you full code if require for latest version.
September 17, 2018 at 9:43 pm #17499test programmerParticipantThe save function is not like this?
add_action( 'fep_save_message', 'before_save_message', 100, 3 ); function before_save_message( $message_id, $message, $update ){ }September 18, 2018 at 1:21 am #17502test programmerParticipantI’ve tried to do
update_post_meta( $announcement_id, '_fep_email_sent', time() );in the action fep_save_announcement but it still got send.September 18, 2018 at 12:00 pm #17512Shamim HasanKeymasterUse like
add_action( 'transition_post_status', function( $new_status, $old_status, $post ) { if ( 'fep_announcement' != $post->post_type ) { return; } update_post_meta( $post->ID, '_fep_email_sent', time() ); }, 10, 3 ); - AuthorPosts
You need to purchase ‘Front End PM PRO’ to create topic in this support forum.
If you already purchased ‘Front End PM PRO’ please LOGIN.