bp_media_attach_media_to_message (美元的消息)
将媒体附加到消息对象
描述
参数
- 美元的消息
-
(必需)
源
文件:bp-media / bp-media-filters.php
函数bp_media_attach_media_to_message(&$message) {if (bp_is_messages_media_support_enabled() && !空($message->id) && !空($ _POST['媒体 '] ) ) { $ media_list = $ _POST['媒体”);数组$ media_ids = ();Foreach ($media_list as $media_index => $media) {$title = !空($media['name']) ?媒体(的名字):美元',';$ attachment_id = !空($media['id']) ?美元的媒体(“id”):0; $media_id = bp_media_add( array( 'title' => $title, 'privacy' => 'message', 'attachment_id' => $attachment_id, ) ); if ( $media_id ) { $media_ids[] = $media_id; //save media is saved in attachment update_post_meta( $attachment_id, 'bp_media_saved', true ); } } $media_ids = implode( ',', $media_ids ); //save media meta for message bp_messages_update_meta( $message->id, 'bp_media_ids', $media_ids ); } }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.0.0 | 介绍了。 |