Post to Buddypress Actvities
Author | Posts |
---|---|
April 29, 2013 at 12:45 pm 2982 | |
Aaron | Hi, I like to know if can use one form to publish an BP activity instead a post. Thsnks |
April 29, 2013 at 6:35 pm 2987 | |
Tareq Hasan | Sorry, it can’t be done. Only thing WPUF can do is creating post or custom post type. |
June 11, 2013 at 9:02 am 4788 | |
quokka | Hi Tareq, Thanks for the great plugin! One concern.. I have been looking on how other plugins do it. [php]/** if ( !function_exists( ‘bp_activity_add’ ) ) $defaults = array( $r = wp_parse_args( $args, $defaults ); return bp_activity_add( array( ‘id’ => $id, ‘user_id’ => $user_id, ‘action’ => $action, ‘content’ => $content, ‘primary_link’ => $primary_link, ‘component’ => $component, ‘type’ => $type, ‘item_id’ => $item_id, ‘secondary_item_id’ => $secondary_item_id, ‘recorded_time’ => $recorded_time, ‘hide_sitewide’ => $hide_sitewide ) ); bp-portfolio-activity.php has a function o update the stream and i gets called on every post creation or update. /* Now record the activity item */ $project = new BP_Portfolio_Item( array( ‘id’ => $result ) ); $title = $project->query->post->post_title; if($id) { $attachment = wp_get_attachment_image_src($project->query->post->post_parent, ‘portfolio-thumb’); $activity_content = sprintf(__( ‘<div class="item-project"><div class="item-project-pictures"><img width="250px" height="170px" src="%s"></div><div class="item-project-content"><div class="item-project-title">%s</div><div class="item-project-url"><a href="%s">%s</a></div><div class="item-project-desc">%s</div></div></div></div>’, ‘bp-portfolio’), $thumbnail, $title, $url, $url, $description); bp_portfolio_record_activity( array( return true; Any chance you could build this support into WPUF? Thanks! |
June 11, 2013 at 5:14 pm 4792 | |
quokka | Looking at WPUF documentation and seems to me like the action hooks wpuf_add_post_after_insert ans wpuf_edit_post_after_update could be used to call a function likke the bp_portfolio_record_activity above that writes to the activity stream, or in’t it that easy? Thanks, |
June 11, 2013 at 7:02 pm 4795 | |
Tareq Hasan | Hey Bas, yes you are right. Using those hooks you add the activities easily. |
June 11, 2013 at 7:09 pm 4796 | |
quokka | Hi Tareq, Thanks…i’m aready fooling around..
Thanks! |
June 11, 2013 at 7:10 pm 4797 | |
quokka | I activated this simple plugin and when I add or update a post with the WPUF forntend form, nothing seems to happen.. Thanks! |
June 11, 2013 at 7:15 pm 4799 | |
Tareq Hasan | Your code is fine and it should work. May be some problem with the email delivery? |
June 11, 2013 at 7:24 pm 4801 | |
quokka | ;-D You are right, seems like php mail() function not working on that domain hosting account. Tried on another domain / WP install and working fine! Thanks Tareq, |
June 11, 2013 at 8:29 pm 4805 | |
quokka | Hi Tareq (and anybody else that maybe interested)… I managed to get this little plugin of mine working. When I create a new post (of custom post type ‘photoalbum’) with WP User Frontend Pro this plugin also writes the activity to the Buddypress Activity Stream. To use this with your own custom post type just search/replace for ‘photoalbum’ and replace with ‘your_custom_post_type_name’ Grab the code and save it as a WordPress plugin and you should be fine.. Thanks Tareq for pointing me in the right direction, and for making those handy action hooks available in WP User Frontend Pro 😀 Take care! The plugin code:
|
June 11, 2013 at 8:48 pm 4806 | |
Mahi | Hello @quokka, Thats great. Would you mind to email this as tutorial to support@wedevs.com with your name , email address and site (as ref) ? If you can include some screenshot images that would be great. We will post it on our Documentation as tutorial with your ref. Cheers. |
June 11, 2013 at 8:52 pm 4807 | |
quokka | Hi Mahi, Sure no problem..I will include the custom post type code from my functions-custom.php as well together with some screenshots.. Can take a day or two because I’m very busy playing with you cool WPUF plugin ;-D Take care and keep up the great work at Wedevs.com! |
July 2, 2013 at 7:47 pm 5502 | |
ggsalas | what I need is to insert custom-fields in activity posts and i can’t. This is the code that doesn’t work: [php]add_filter( ‘bp_blogs_activity_new_post_content’, ‘record_post_activity_content’, 1, 3 ); |
July 2, 2013 at 8:33 pm 5504 | |
Tareq Hasan | Make sure your filter is actually running and you are getting the correct post id. I am not that much experienced in buddypress. |
July 2, 2013 at 9:58 pm 5507 | |
ggsalas | I found something, when i set to false:
I get “array” text in activity content |
July 2, 2013 at 10:22 pm 5508 | |
quokka | Hi.. The true is for returning a single custom field value.. Try changing this: To:
Does that fix it? Regards, |