Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Plugin: Forum Restriction


davidbessler
Member

@davidbessler

Can someone tell me how to include the text of the first post in the new topic in the notification email. Here is the code I am using:

function forum_restriction_send_email ($topic_id){

if (bb_get_option('forum_restriction_notify') == "on") {

global $forum_restriction_allowed_in_forum, $bbdb, $bb_current_user;

$topic = get_topic($topic_id);

$forum = $topic->forum_id;

$mailing_list = split(",",$forum_restriction_allowed_in_forum[$forum]);

$message = __("There is a new topic called: %1$s. You can see it here %3$s. You got this email because Bessler decided to turn on the option to notify all members of restricted forums when there are new TOPICS started in each FORUM. However, don't forget to click on "Add this topic to your favorites" so that you get an email when someone adds a POST to this TOPIC. This will keep you involved in that particular discussion. Kapish?");

foreach ($mailing_list as $member) {

$userdata = $bbdb->get_var("SELECT ID FROM $bbdb->users WHERE display_name = '$member'");

$email_address .= $bbdb->get_var("SELECT user_email FROM $bbdb->users WHERE ID='$userdata'").",";

}

mail( $email_address, '['.bb_get_option('name') . '] ' . __('New Topic In Private Forum:').get_forum_name($forum),

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

'From: ' . bb_get_option('admin_email')

);

}

}

add_action('bb_new_topic', 'forum_restriction_send_email');

Skip to toolbar