Hook announcement send


Home Forums Front End PM PRO Hook announcement send

This topic is: Resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16050
    test programmer
    Participant

    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?

    #16053
    Shamim Hasan
    Keymaster

    for 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

    #16054
    test programmer
    Participant

    Thanks 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?

    #16056
    Shamim Hasan
    Keymaster
    add_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;
    }
    
Viewing 4 posts - 1 through 4 (of 4 total)

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.