• Resolved handyandywilson

    (@handyandywilson)


    Hey,

    I would like to link this to buddypress activity to allow members to update their activity from their email. I know buddypress has a different way of handling posts but if you could point me in the right direction as to how I could hook into a user’s email and extract email content I can figure out how to post to buddypress.

    Really awesome plugin though. I’m a UIX designer and it’s becoming apparent users don’t go to the content or go to post anymore, they want it to be done from their existing interfaces (ie email). You are on to something.

    Cheers,

    Andrew

    https://wordpress.org/plugins/postie/

Viewing 12 replies - 1 through 12 (of 12 total)
  • I’m working on trying to get custom post types working in the activity stream too. And I sort of understand what you did but am not good with php and seeing your completed snippet or a tutorial would help. Thank your post.

    Thread Starter handyandywilson

    (@handyandywilson)

    Here’s my first attempt using Postie’s recommendations: http://postieplugin.com/extending/

    function my_postie_post_function($post) {
    $content = $post[‘post_content’];
    $user_ID = $post[‘user_ID’];
    $content = sanitize_text_field($content);
    bp_activity_post_update(array('content' =>$content, 'user_id' => $user_ID));
    exit();
    }
     add_filter('postie_post_before',’my_postie_post_function’);

    … but hit a bug. When checking for mail postie outputs this error

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘’my_postie_post_function’’ not found or invalid function name in domain.com/wp-includes/plugin.php on line 213

    even if I output this function with nothing in it I still get this error. Any advice?

    Cheers,

    Andrew

    Plugin Author Wayne Allen

    (@wayneallen-1)

    Where did you put the function?

    Don’t call exit() just return null.

    Thread Starter handyandywilson

    (@handyandywilson)

    Thanks Wayne, in filterPostie.php as recommended. Any ideas?

    Plugin Author Wayne Allen

    (@wayneallen-1)

    Please post the entire filterPostie.php

    Thread Starter handyandywilson

    (@handyandywilson)

    As above

    <?php function my_postie_post_function($post) {
    $content = $post[‘post_content’];
    $user_ID = $post[‘user_ID’];
    $content = sanitize_text_field($content);
    bp_activity_post_update(array('content' =>$content, 'user_id' => $user_ID));
    }
     add_filter('postie_post_before',’my_postie_post_function’); ?>
    Thread Starter handyandywilson

    (@handyandywilson)

    OK so if I directly edit the plugin files (I know, I know) and add

    global $bp;
        bp_activity_post_update(array('content' =>$content, 'user_id' => $postAuthorDetails['user_ID']));

    to the end of

    $details = array(
            'post_author' => $poster,
            'comment_author' => $postAuthorDetails['author'],
            'comment_author_url' => $postAuthorDetails['comment_author_url'],
            'user_ID' => $postAuthorDetails['user_ID'],
            'email_author' => $postAuthorDetails['email'],
            'post_date' => $post_date,
            'post_date_gmt' => $post_date_gmt,
            'post_content' => $content,
            'post_title' => $subject,
            'post_type' => $post_type, /* Added by Raam Dev <raam@raamdev.com> */
            'ping_status' => get_option('default_ping_status'),
            'post_category' => $post_categories,
            'tags_input' => $post_tags,
            'comment_status' => $comment_status,
            'post_name' => sanitize_title($subject),
            'post_excerpt' => $post_excerpt,
            'ID' => $id,
            'customImages' => $customImages,
            'post_status' => $post_status
        );

    in postie-functions.php, it works a treat.

    Now how can I hook into this properly? (im not a developer) Any help appreciated 🙂

    Cheers,

    Andrew

    Plugin Author Wayne Allen

    (@wayneallen-1)

    You were on the right track before. What directory was filterPostie.php in?

    Thread Starter handyandywilson

    (@handyandywilson)

    cool. In /wp-content/ directory Wayne.

    Thread Starter handyandywilson

    (@handyandywilson)

    Also is there a way to prevent a post from being generated as I am looking to solely transfer the email content to buddypress activity however in doing so an additional post is created.

    Cheers!

    Plugin Author Wayne Allen

    (@wayneallen-1)

    > is there a way to prevent a post from being generated

    return null from postie_post_before filter as previously stated.

    I’ve been following that ticket for much of its life (and even tried to contribute to the conversation a few times. This really is one of those headline features for a release and particularly excited about it. This advancement, even though it is in its early stages is one of those things that will push BuddyPress forward by a significant leap

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to post to buddypress activity?’ is closed to new replies.