Automatically adding a new blog post’s activity to Favorites
-
Been scouring the forums and couldn’t find this anywhere…
I’m trying to make a plugin that takes a a blog post from a logged-in user and automatically adds it to their own BuddyPress Favorites list when they submit. The blog post writing stage is fine – I’m hacking a previous the user-submitted-posts WordPress plugin. However, I’m having trouble working out how to programmatically add the submitted post to the BuddyPress favorites.
After setting up the blog post vars into $postData, they get inserted with:
`$newPost = wp_insert_post($postData);`$newPost is then set to the blog post ID, however I can’t find a BuddyPress function to return the activity ID, based on that blog post ID. If there is one I can then use that in the bp_activity_add_user_favorite call. Have I missed something in the BuddyPress functions?
- The topic ‘Automatically adding a new blog post’s activity to Favorites’ is closed to new replies.