Notifications
Clear all

Script WPforo hook

1 Posts
1 Users
0 Reactions
9 Views
st7878
Posts: 113
Topic starter
(@aima-forum)
Estimable Member
Joined: 5 years ago

duplicate
Hello wpForo Support Team,

I’m developing a plugin to send Telegram notifications when a post is approved by a moderator (i.e., when its status changes from 1 (Unapproved) to 0 (Approved)). I’m currently using the wpforo_after_add_post hook to detect new posts, and it works fine for posts that are immediately published (status = 0). However, this hook doesn’t fire when a post’s status is updated during moderation (e.g., from 1 to 0).

I’ve also tried wpforo_after_approve_post and wpforo_after_update_post, but they don’t seem to work in my setup (wpForo version [2.1.6]). When I approve a post, I don’t see any logs indicating that these hooks are triggered. For reference, here’s a snippet of my code:

add_action('wpforo_after_approve_post', 'wpforo_telegram_send_approved_post', 10, 1);
function wpforo_telegram_send_approved_post($postid) {
global $wpforo;
error_log('wpForo to Telegram: Hook wpforo_after_approve_post triggered. Post ID: ' . $postid);
// Further logic to send Telegram notification
}

Could you please confirm which hook or event is triggered when a post’s status changes from 1 to 0 (e.g., during moderation approval)? Any guidance would be greatly appreciated!

Thank you.

Topic Tags