bbp_new_reply_pre_insert action failing post insert
-
Hi I’ve been asked to hook in some email notification for every time a user posts on the forum.
`add_action( ‘bbp_new_reply_pre_insert’, ‘bbp_notification_hack’ );
function bbp_notification_hack( $data, $meta ) {
$user = get_userdata( $data[‘post_author’] );
$email = “Author: ” . $user->data->display_name . ” [” . $user->data->user_email . “]\n”;
$email .= “Post Title: ” . $data[‘post_title’] . “\n”;
$email .= “Post Content: ” . $data[‘post_content’] . “\n”;
$email .= “Post Status: ” . $data[‘post_status’] . “\n”;
$email .= “Post Type: ” . $data[‘post_type’] . “\n”;mail( ’emailaddress’, ‘Notification: new forum post’, $email );
return;
}`
The problem is the post is not being inserted! I get the error
ERROR: The following problem(s) have been found with your reply:Please try again.
Does anyone know why this is?
- You must be logged in to reply to this topic.