Viewing 9 Topics - 16 through 24 (of 24 total)
Author Posts
July 3, 2013 at 9:14 am 5524
Tareq Hasan Tareq Hasan

You should return true. return get_post_meta($post->ID, 'txt_link', true);

July 3, 2013 at 1:32 pm 5530
ggsalas ggsalas

@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 5532
quokka quokka

Hi..

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 5561
ggsalas ggsalas

Yes @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? Adding print_r($post); not work.

July 3, 2013 at 7:47 pm 5563
ggsalas ggsalas

I 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 5691
ggsalas ggsalas

Hi @Tareq,

Today I check that this code is working perfectly creating a post with wordpress and not working with WPUF Pro.

I don’t know what info you need to resolve it. I have no problem to test in my site.

Thanks

July 8, 2013 at 8:31 pm 5694
ggsalas ggsalas

Apparently 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 5885
ggsalas ggsalas

Hi @quokka I have tested your plugin and do the same error:

plugin actiity add

<?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 32576
Aaron Aaron

Can i get this to work using WPUF Registration Form? So when someone registers to my site it will post to the Buddypress Activity?

Thanks

Viewing 9 Topics - 16 through 24 (of 24 total)