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.
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
Where did you put the function?
Don’t call exit() just return null.
Thanks Wayne, in filterPostie.php as recommended. Any ideas?
Please post the entire filterPostie.php
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’); ?>
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
You were on the right track before. What directory was filterPostie.php in?
cool. In /wp-content/ directory Wayne.
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!
> 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