Inserting activity content via plugin
-
Am successfully inserting a post via a plugin into a website on which buddypress is active.
The post comes in properly and is properly recorded on the home/post page.
However
these posts are NOT recorded in the sitewide /users activity streams.
$post_id = wp_insert_post( array( 'post_author' => $user_id, 'post_title' => $post_title, 'post_content' => $apost_content, 'post_category' => $category_ids, 'tags_input' => $tags, 'post_status' => 'publish' ), $wp_error );
1) any ideas how to remedy same.
2) I understand that as per
andI should be able to insert content into activity directly
I thought i could insert the same content into Activity directly with something like:
$activity_id = bp_activity_add( array( 'action' => 'A link from NewsSite', // The activity action - e.g. "Jon Doe posted an update" 'content' => $post_content, // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!" 'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent 'type' => false, // The activity type e.g. activity_update, profile_updated 'primary_link' => 'false', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) 'user_id' => bp_loggedin_user_id(), // Optional: The user to record the activity for, can be false if this activity is not for a user. 'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id 'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id 'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded 'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream? 'is_spam' => false // Is this activity item to be marked as spam? ), );
but that didn’t happen!
Any help much appreciated.
Should be learning this stuff faster, but i’m not !!!
- The topic ‘Inserting activity content via plugin’ is closed to new replies.