Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to send forum posts to email

  • @xtint

    Member

    i need help with creating a plugin that helps send a forum post through email.i have achieved sending a notification with title of the post and author but i need to also show the contents of the post.Also i need some one to be able to reply to this post through email.Any help please.Am new to bbpress and plugin creation.

    Cheers

Viewing 5 replies - 1 through 5 (of 5 total)
  • @michael3185

    Member

    Neat idea xtint – I like it. I’m not a bbPress hotshot by any means, and am also busy with my own forum set-up, but I’ll keep tabs on this one. There are some superb coders in the forum, and I’m sure you’ll get some pointers soon enough.

    @xtint

    Member

    Thanks Michael3185.nways one of the things i need right now is the filter that pulls the post’s content like this one for the topic

    topic_title.

    Cheers

    Xtint

    @xtint

    Member

    i have now figured out how to send forum posts to registered users through email but what i have failed is to let users reply to this post through email.please any one have an idea.

    xtint

    @gautam2011

    Member

    Can you give me the current source of the plugin you have made?

    You can get the post text (of the first post of the topic) by:

    global $bbdb;

    $topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic

    $first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");

    $content = urlencode(substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0,300));

    $content = str_replace('+','%20', $content);

    $content = str_replace("’","'", $content);

    $post_summary = stripslashes($content);

    @xtint

    Member

    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

    ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar