bp_media_forums_save_gif_data( $post_id )
save gif data for forum, topic, reply
Description
Parameters
- $post_id
-
(Required)
Source
File: bp-media/bp-media-filters.php
function bp_media_forums_save_gif_data( $post_id ) { if ( ! bp_is_forums_gif_support_enabled() ) { return; } if ( ! empty( $_POST['bbp_media_gif'] ) ) { // save activity id if it is saved in forums and enabled in platform settings $main_activity_id = get_post_meta( $post_id, '_bbp_activity_id', true ); // save gif data $gif_data = json_decode( stripslashes( $_POST['bbp_media_gif'] ), true ); if ( ! empty( $gif_data['saved'] ) && $gif_data['saved'] ) { return; } $still = bp_media_sideload_attachment( $gif_data['images']['480w_still']['url'] ); $mp4 = bp_media_sideload_attachment( $gif_data['images']['original_mp4']['mp4'] ); $gdata = array( 'still' => $still, 'mp4' => $mp4, ); update_post_meta( $post_id, '_gif_data', $gdata ); $gif_data['saved'] = true; update_post_meta( $post_id, '_gif_raw_data', $gif_data ); //save media meta for forum if ( ! empty( $main_activity_id ) && bp_is_active( 'activity' ) ) { bp_activity_update_meta( $main_activity_id, '_gif_data', $gdata ); bp_activity_update_meta( $main_activity_id, '_gif_raw_data', $gif_data ); } } else { delete_post_meta( $post_id, '_gif_data' ); delete_post_meta( $post_id, '_gif_raw_data' ); } }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.