Tagged: Mediapress Import
I am migrating a Drupal 7 site and working on a plugin to import the galleries from a CSV file. All going well and can create a gallery and add media. However I can’t work out if I can import comments that other users have made on the media items. Could someone point me in the right direction, many Thanks!
Hi Geoff,
Welcome to BuddyDev.Thank you for the question.
The media comments are actually BuddyPress Activity entries.
We add an activity meta key
_mpp_media_id
and its value is the numeric media id to which this activity belongs.
We also set the type of the activity tompp_media_upload
Hope that helps.
Regards
BrajeshThanks very much for that Brajesh.
Made some progress on this and have managed to add a to a gallery but when I attempt to add a comment to an individual media item the gallery appears at gallery level not on the media item.
Here’s my code:
`$new_activity_id = mpp_media_record_activity( array(
‘media_id’ => $new_file_id,
‘type’ => ‘media_comment’,
‘context’ => ‘media’,
‘user_id’ => 5,
‘content’ => ‘The first imported media comment’,
) );`I would be grateful if you could point out my error, thanks.
Hi Geoff,
Thank you for the reply.
I am sorry for the delay.It is a bit complicated for the media comment.
Please take a look at MPP_Ajax_Comment_Helper::post_comment for how are we creating comment for media.
https://github.com/buddydev/mediapress/blob/master/core/ajax/class-mpp-ajax-comment-helper.php#L59
Regards
Brajesh
You must be logged in to reply to this topic.