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
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | 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.