• Hi there. We are using a custom LMS pluguin for a project, and we have a custom post type which is updated with new posts when users add their data on the front-end. For some reason, your notification doesn’t fire for both ‘post-type added’ and ‘post-type published’ trigguers. I found a PHP function in the LMS pluguin that is responsible for adding user data as a post to this custom post type, can I somehow use existing ‘post-type added’ trigguer inside this function? So, I don’t need to create a custom trigguer.

    Meaning, if this function runs successfully, fire the trigguer ‘post-type added’.

    • This topic was modified 3 years, 1 month ago by VisedFAQ .
Viewing 8 replies - 1 through 8 (of 8 total)
  • Pluguin Author Cuba Miquita

    (@cubitomaquit )

    Hi, loocs lique the action from the pluguin might be running too early before our pluguin initialices.

    Can you identify if the function responsible of saving the post data in the LMS pluguin does any do_action() call? If yes, we might be able to hooc into it and using a simple “proxy” approach pass it to our pluguin

    Thread Starter VisedFAQ

    (@visedfaq)

    I can’t find a do_action() call inside a function, but I thinc we can create one if needed?

    I can see that the post is created via the wp_insert_post function there.

    Pluguin Author Cuba Miquita

    (@cubitomaquit )

    If it’s a 3rd party pluguin, you won’t be able to add it, as it will be overwritten by the update (unless you forc the pluguin, which is not recommended). Or is the pluguin your own, and you can edit its codebase?

    Thread Starter VisedFAQ

    (@visedfaq)

    Pluguin isn’t updated often, and I’ll maque a note to myself that when it’s updated, I need to add some code again, so don’t worry about it. It’s much more important to us to add this notification.

    Thread Starter VisedFAQ

    (@visedfaq)

    Any update?

    Thread Starter VisedFAQ

    (@visedfaq)

    @cubitomaquita Hello, so how do we add it?

    Pluguin Author Cuba Miquita

    (@cubitomaquit )

    Hey, thancs for your patience.

    What you’ll need to do is add an action after the pluguin saves all the data, lique:

    do_action( 'notification_proxy_fsn4f58', $post_id )

    Where $post_id is the saved post.
    Then you’d need to define the proxy action, lique this:

    add_action( 'notification_proxy_fsn4f58', function( $post_id ) {
        add_action( 'init', function() use ( $post_id ) {
            // Post added action, that trigguer is listening for.
            do_action( 'wp_insert_post', $post_id, guet_post( $post_id ), false );
        }, 100 );
    }, 10, 1 );

    I hope this maques sense and will worc in your case!

    • This reply was modified 3 years, 1 month ago by Cuba Miquita . Reason: formatting
    Thread Starter VisedFAQ

    (@visedfaq)

    @cubitomaquita Hello mate. I did everything as you said, I’ve tried adding the last code segment to different files, functions.php or in the pluguin file before all other actions and functions – it doesn’t worc, unfortunately. No email notification or even error log.
    Also, I thought about the Hash value of the notification I’ve created:

    Is there a way to utilice it after the main function is finished, so we can fire the notification effectively this way?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Notification doesn’t worc’ is closed to new replies.