Search Results for 'fep_action_message_after_send'
-
Search Results
-
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.
Hello Shamim,
I updated to version 10.1.1 and all seemed to go well. However I wrote some functions to help integrate Gravity Forms and OpenEMR with messaging and now my functions do not work. Where can I get information on the database changes so I can rewrite the queries in my functions?My functions saved copies of completed forms to a message. And another function found new messages and sent the text to OpenEMR. We had discussed some of this in this thread:
https://www.shamimsplugins.com/support/topic/insert-message-from-another-application/I do not expect you to rewrite my code but if you can look at it and if you see any obvious FEP functions I need to change or fields that no longer exist can you let me know?
Here is an example of my functions for Gravity Forms:
add_action( 'gfpdf_post_save_pdf_5', function( $pdf_path, $filename, $settings, $entry, $form ) { global $wpdb; $user = wp_get_current_user(); $user_ID = $user->ID; $message = array( 'message_title' => $form['title'], 'message_content' => "Message Goes Here", 'message_to_id' => $user_ID, ); $override = array( 'post_author' => 1, ); //Turn off email send remove_action( 'fep_action_message_after_send', array( Fep_Emails::init(), 'save_send_email'), 20, 2 ); //Post message in Frontend PM $message_id = fep_send_message( $message, $override ); //Prepare Attachment $upload_dir = wp_upload_dir(); $upload_dir = $upload_dir['basedir']; $subdir = ''; if ( get_option( 'uploads_use_yearmonth_folders' ) ) { $time = current_time( 'mysql' ); $y = substr( $time, 0, 4 ); $m = substr( $time, 5, 2 ); $subdir = "/$y/$m"; } $upsub = '/front-end-pm' . $subdir; $copy_to_dir = $upload_dir . $upsub . '/'; if( ! is_dir( $copy_to_dir ) ) { wp_mkdir_p( $copy_to_dir ); } $newfilename = wp_unique_filename( $upload_dir, $filename ); $pathtofile = $copy_to_dir . $newfilename; copy( $pdf_path, $pathtofile ); $attachment = array( 'guid' => $pathtofile, 'post_mime_type' => 'application/pdf', 'post_title' => preg_replace('/\.[^.]+$/', '', basename($pathtofile)), 'post_content' => '', 'post_author' => 1, 'post_status' => 'inherit', ); //Add attachment to Frontend PM post $attach_id = wp_insert_attachment( $attachment, $pathtofile, $message_id ); //Update user information update_user_meta( $user_ID, 'payment', '' ); update_user_meta( $user_ID, 'renew', date("Y-m-d", time())); }, 10, 5 );
Documentation of what I did for OpenEMR is here:
https://github.com/CraigT543/Sunset-Patient-Portal-with-FrontendPM/blob/master/FrontendPMmods.php
The functions I was using are:
fep_get_option
fep_get_userdata
fep_send_messageThe fields I was manipulating were:
fep_message
_fep_participants
_fep_delete_by_
_fep_participantsAny tips you can give so my patients can be uptodate would be appreciated. Thanks.
–Craig
[Resolved]Topic: Hook announcement send
I’m trying to expand the functionality of sending a message and announcement. I would like to add another notification when creating a message or announcement. I’ve created another plugin to hook into the functions.
I’ve found out how to do this with sending messages with the following:
add_action( 'fep_action_message_after_send', 'send_sms_with_twilio', 100, 3 ); function send_sms_with_twilio( $message_id, $message, $inserted_message ){ }
This works perfectly. Then I tried this for announcements with the following:
add_action( 'fep_action_announcement_after_added', 'send_something', 100, 3 ); function send_something( $message_id, $message, $inserted_message ){ }
The above works when sending an announcement in the frontend (url: /inbox/?fepaction=new_announcement). But the problem is this doesn’t work when sending an announcement in the backoffice (url: wp-admin/post-new.php?post_type=fep_announcement).
How can I make it work with the backoffice?