Home › Forums › Plugin Support › WP User Frontend Pro › Post to Buddypress Actvities
Tagged: activity, buddypress, error
This topic contains 24 replies, has 5 voices, and was last updated by Aaron 4 years, 2 months ago.
-
AuthorPosts
-
July 2, 2013 at 10:22 pm #5508
Hi..
That's normal…The true is for returning a single custom field value..
http://codex.wordpress.org/Function_Reference/get_post_metaTry changing this:
if( $post-_post_type == 'post' ) {
To:
if( $post->post_type == 'post' ) {
Does that fix it?
Regards,
BasJuly 3, 2013 at 9:14 am #5524You should return true.
return get_post_meta($post->ID, 'txt_link', true);
July 3, 2013 at 1:32 pm #5530@quokka I tried your change but no result.
@tareq When I set get_post_meta to “true” I have no results.In this code the only text appears is “This”:
add_filter( 'bp_blogs_activity_new_post_content', 'record_post_activity_content',1, 3 ); function record_post_activity_content($activity_content, $post,$post_permalink ){ global $post; return get_post_meta($post->ID, 'txt_link', true).'This'; }
Thanks for your help, I hope can resolve.
July 3, 2013 at 1:42 pm #5532Hi..
Try to add:
print_r($post);
under:global $post;
Does that return anything?
Looks no post is passed to the function..July 3, 2013 at 7:06 pm #5561Yes @quokka the problem is that i can't get the post id. I tried with this code and it works:
return get_post_meta(577, 'txt_link', true).'This1';
How I can get the post ID? Addingprint_r($post);
not work.July 3, 2013 at 7:47 pm #5563I found that the blog post ID is the “secondary_item_id” parameter in bp_blogs_record_activity()
But I not find a way to get the post id.
July 8, 2013 at 7:30 pm #5691July 8, 2013 at 8:31 pm #5694Apparently the problem is that WPUF not use the “save_post” WordPress action. This is the support answer I recive in WPMUDEV.
July 11, 2013 at 10:17 pm #5885Hi @quokka I have tested your plugin and do the same error:
<?php /* Plugin Name: WPUF POSTS TO Buddypress Activity Stream Plugin URI: http://www.basdebie.com Description: This plugin hooks into WP User Frontend and posts to the Buddypress Activity Stream on new photoalbum submission Version: 1.0 Author: Bas Debie modif. Author URI: http://www.basdebie.com License: GPL2 */ /** * Record an activity item * This code is taken from Nicolas Crocfer's BuddyPress Portfolio Plugin */ function bd_custom_bp_record_activity( $args = '' ) { if ( !function_exists( 'bp_activity_add' ) ) return false; $defaults = array( 'id' => false, 'user_id' => '', 'action' => '', 'content' => '', 'primary_link' => '', 'component' => 'post', 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => gmdate( "Y-m-d H:i:s" ), 'hide_sitewide' => false ); $r = wp_parse_args( $args, $defaults ); extract( $r ); 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 ) ); } /** * After post update the Buddypress Activity Stream */ function bd_after_post_insert( $post_id ) { global $bp; $activity_content = get_post_meta($post->ID, 'txt_link', true).'this yes ahora'; // if( get_post_type( $post_id ) == "photoalbum" ) { bd_custom_bp_record_activity( array( 'user_id' => $bp->loggedin_user->id, 'action' => sprintf(__('%s creó una nueva publicación \''.get_the_title($post_id).'\' at %s'), "<a href='".$bp->loggedin_user->domain."/'>".$bp->loggedin_user->fullname."</a>", get_permalink( $post_id ) ), 'primary_link' => get_permalink( $post_id ), 'type' => 'new_post', 'item_id' => $bp->loggedin_user->id, )); // } } add_action( 'wpuf_add_post_after_insert', 'bd_after_post_insert' ); ?>
December 19, 2014 at 4:04 am #32576Can i get this to work using WPUF Registration Form? So when someone registers to my site it will post to the Buddypress Activity?
Thanks
-
AuthorPosts
The topic ‘Post to Buddypress Actvities’ is closed to new replies.