rtmedia_transcoded_media_added_callback

The rtMedia for WordPress, BuddyPress and bbPress rtmedia transcoded media added callback function.

Description

rtmedia_transcoded_media_added_callback( $attachment_id ); 

Parameters (1)

0. $attachment_id
The attachment id.

Usage

  1. if ( !function_exists( 'rtmedia_transcoded_media_added_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'rtmedia-for-wordpress-buddypress-and-bbpress/app/main/controllers/template/rtmedia-ajax-actions.php'; 
  3.  
  4. // The attachment id. 
  5. $attachment_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = rtmedia_transcoded_media_added_callback($attachment_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/app/main/controllers/template/rtmedia-ajax-actions.php  
  1. function rtmedia_transcoded_media_added_callback( $attachment_id ) { 
  2. if ( isset( $attachment_id ) && ! empty( $attachment_id ) ) { 
  3. $job_for = get_post_meta( $attachment_id, '_rt_media_source', true ); 
  4. if ( rtmedia == $job_for && class_exists( 'RTMediaModel' ) ) { 
  5. $model = new RTMediaModel(); 
  6. $media = $model->get_media( array( 'media_id' => $attachment_id ), 0, 1 ); 
  7. if ( isset( $media[0] ) && isset( $media[0]->activity_id ) && ! empty( $media[0]->activity_id ) ) { 
  8. $activity_id = $media[0]->activity_id; 
  9. $media_id = $media[0]->id; 
  10. if ( $activity_id && isset( $media_id ) && ! empty( $media_id ) && function_exists( 'rtmedia_is_comment_media' ) && rtmedia_is_comment_media( $media_id ) ) { 
  11. global $wpdb; 
  12. $activity_content = $wpdb->get_var( $wpdb->prepare( "SELECT content FROM {$wpdb->base_prefix}bp_activity WHERE id = %d", $activity_id ) ); 
  13. if ( function_exists( 'rtmedia_update_content_of_comment_media' ) ) { 
  14. rtmedia_update_content_of_comment_media( $media[0]->id, $activity_content );