Home › Forums › Front End PM PRO › Hook announcement send
Tagged: announcement, backoffice, hook
- This topic has 3 replies, 2 voices, and was last updated 7 years, 4 months ago by Shamim Hasan.
- AuthorPosts
- August 1, 2018 at 12:03 am #16050test programmerParticipant
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?
August 1, 2018 at 12:23 am #16053Shamim HasanKeymasterfor back-end please use
fep_save_announcement.
Next update will be a major update of this plugin. Most of the code is changed in this version. Please read https://wordpress.org/support/topic/need-help-for-testing-new-beta-version-10-0-1beta1/ to make your changes compatible with future release.See https://github.com/shamim2883/front-end-pm/tree/1001beta1 for code
August 1, 2018 at 1:40 am #16054test programmerParticipantThanks for the hook fep_save_announcement. I’ve written the following:
add_action( 'fep_save_announcement', 'send_something', 100, 3 ); function send_something( $message_id, $message, $inserted_message ) { echo '<pre>'; print_r($message_id); echo '</pre>'; echo '<pre>'; print_r($message); echo '</pre>'; echo '<pre>'; print_r($inserted_message); echo '</pre>'; die; }But in my $message variable I don’t see how I can get the receivers of the announcement. Do you know how I can get it?
August 1, 2018 at 9:45 am #16056Shamim HasanKeymasteradd_action( 'fep_save_announcement', 'send_something', 100, 3 ); function send_something( $announcement_id, $announcement, $update ){ echo '<pre>'; print_r( fep_get_participant_roles( $announcement_id ) ); echo '</pre>'; die; } - 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.