Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to send forum posts to email

Gautam that is the source.i adopted it from Thomas Klaiber post notification plugin.Klaiber plugin sends one email notification on topics in their favourites only without the contents.so i need to figure out how to reply to a post through email.

<?php

function notification_new_post()

{

global $bbdb, $bb_table_prefix, $topic_id,$bb_current_user,$post_id;

$all_users = notification_select_all_users();

foreach ($all_users as $userdata) :

$topic = get_topic($topic_id);

$posts = get_thread($topic_id, 1, 1);

$posts = array_reverse($posts);

$last = array_pop($posts);

$last_text = strip_tags($last->post_text);

$message = __(“There is a new post on the forumnnTopic title: %1$s nPosted by: %2$snn Url:%3$s nn Contents nn %4$s”);

mail( $userdata->user_email, bb_get_option(‘name’) . ‘:’ . __(‘Notification’),

sprintf( $message, $topic->topic_title,get_user_name($bb_current_user->ID),get_topic_link($topic_id),$last_text),

‘From: ‘ . bb_get_option(‘admin_email’) );

endforeach;

}

add_action(‘bb_new_post’, ‘notification_new_post’);

function notification_select_all_users()

{

global $bbdb;

$all_users = $bbdb->get_results(“SELECT ID, user_email FROM $bbdb->users WHERE user_status=0”);

return $all_users;

}a

?>

Skip to toolbar