Skip Navigation

[Resolved] Custom Post Types in Buddypress Activity

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 reply, has 2 voices.

Last updated by Beda 5 years, 8 months ago.

Author
Posts
#1211963

I am trying to: Display the New Added and Updated Custom Post Types in Buddypress Activity
I have inserted the below code in Settings/Custom Code, and does not work
The Custom Post Type Name is "Contacts" and the slug is -partner-
Please advice. thx

toolset_snippet_security_check() or die( 'Direct access is not allowed' );
function gg_types_post_type_args_filter( $args, $post_type ) {

if ( $post_type == 'partner' ) {

$args['supports'][] = 'buddypress-activity';

$args['bp_activity'] = array(

'component_id' => buddypress()->activity->id,

'action_id' => 'new_stage',

'contexts' => array(

'activity',

'member'),

'position' => 40,

);

$args['labels']['bp_activity_admin_filter'] = __( 'New %s published', 'types-bp-activity' );

$args['labels']['bp_activity_front_filter'] = __( 'Contacts', 'types-bp-activity' );

$args['labels']['bp_activity_new_post'] = __( '%1$s posted a new contact', 'types-bp-activity' );

$args['labels']['bp_activity_new_post_ms'] = __( '%1$s posted a new contact, on the site %3$s', 'types-bp-activity' );

}

return $args;

}

add_filter( 'wpcf_type', 'gg_types_post_type_args_filter', 10, 2 );

Link to a page where the issue can be seen:

I expected to see:

Instead, I got:

#1212107

Toolset offers no integration for BuddyPress or vice-versa

The only ever integration we had, was in Toolset Layouts (to display certain parts of BuddyPress)
That has been removed many years ago.

I see that you use your custom Code function "gg_types_post_type_args_filter()" by inserting it in the Types Code editor. This does not mean it will work - this code also will fail in the functions.php of your theme.

It seems to me you want to alter arguments of the Toolset Post Type with the wpcf_type filter.
We can usually not help with this - please see the context we can help with in this example:
https://toolset.com/forums/topic/add-capability-to-post-type/#post-163945
We also do not document the filter, which means it is not a filter that we suggest for usage just yet publicly. It might change and then it would break in future.

Please consult with the BuddyPress support what you need to alter in a native WordPress Post type - then, that can simply be applied to Toolset's Post Types as well.
This means, "if it works with a Native WordPress Post Type, then it works with Toolset"
You can for example also generate a Post Type with this tool:
hidden link

To help you - here is the $data contained in wpcf_type of a post type toolset-post-type:

Array ( 
	[icon] => admin-post 
	[labels] => Array ( 
		[name] => Toolset Post Types 
		[singular_name] => Toolset Post Type 
		[add_new] => Add New 
		[add_new_item] => Add New Toolset Post Type
		[edit_item] => Edit Toolset Post Type
		[new_item] => New Toolset Post Type
		[view_item] => View Toolset Post Type
		[search_items] => Search Toolset Post Type
		[not_found] => No Toolset Post Types found 
		[not_found_in_trash] => No Toolset Post Types found in Trash 
		[parent_item_colon] => Parent text 
		[all_items] => All items 
		[enter_title_here] => Enter title here 
	) 
	[slug] => toolset-post-type 
	[editor] => classic 
	[description] => 
	[public] => 1 
	[supports] => Array ( 
		[0] => title 
		[1] => editor 
		[editor] => 
		[author] => 
		[thumbnail] => 
		[excerpt] => 
		[trackbacks] => 
		[custom-fields] => 
		[comments] => 
		[revisions] => 
		[page-attributes] => 
		[post-formats] => 
	) 
	[rewrite] => Array ( 
		[enabled] => 1 
		[with_front] => 1 
		[feeds] => 1 
		[pages] => 1 
	) 
	[has_archive] => 1 
	[has_archive_slug] => 
	[show_in_menu] => 1 
	[show_in_menu_page] => 
	[show_ui] => 1 
	[publicly_queryable] => 1 
	[can_export] => 1 
	[show_in_nav_menus] => 1 
	[query_var_enabled] => 1 
	[query_var] => 1 
	[permalink_epmask] => 1 
	[rest_base] => toolset-post-type 
	[wpcf-post-type] => 
	[_builtin] => 
	[_toolset_edit_last] => 1552134763 
	[_wpcf_author_id] => 1 
	[is_repeating_field_group] => 
	[is_intermediary_post_type] => 
	[exclude_from_search] => [hierarchical] => [
	show_in_rest] => 
	[menu_icon] => dashicons-admin-post 
)

As you see, supports is an array:

[supports] => Array ( 
		[0] => title 
		[1] => editor 
		[editor] => 
		[author] => 
		[thumbnail] => 
		[excerpt] => 
		[trackbacks] => 
		[custom-fields] => 
		[comments] => 
		[revisions] => 
		[page-attributes] => 
		[post-formats] => 
	) 

I hope that helps, we can however not alter or provide the code within the Filter wpcf_type() as that would be custom code, something not supported by Toolset Support.