Filters

Description

  • rtawss3_delete_bucket_table_entries

By default, rtAmazon s3 do not delete bucket table entries if it do not find the bucket on s3. If you want to delete the table entries then pass false to this filter.

add_filter( 'rtawss3_delete_bucket_table_entries', 'rtawss3_filter_to_delete_bucket_table_entries',10,1);
function rtawss3_filter_to_delete_bucket_table_entries( $flag ){
    $flag = false;
    return $flag;
}
  • replace_aws_img_urls_from_activities

If media URLs are getting broken on your activity page then please apply the following filter.

/**
 * Prevent changing urls of activity image
 *
 * @return bool return true if buddypress multisite is enabled.
 */
function rtmedia_buddypress_mu_enabled() {
    return true;
}
add_filter( 'replace_aws_img_urls_from_activities', 'rtmedia_buddypress_mu_enabled' );
  • rtawss3_before_virtual_folder_path

You can use this filter and update the folder path according to your requirement.

function custom_rtawss3_before_virtual_folder_path( $prefix, $path_info ){
    $prefix = 'my/new/path/';
    return $prefix;
}
add_filter( 'rtawss3_before_virtual_folder_path', 'custom_rtawss3_before_virtual_folder_path', 10, 2 );
  • rtawss3_get_attachment_url

By default, the URLs returned by the AWS API are HTTPS URLs. If you want to use HTTP version of the URLs, you can use this filter. Using this filter you will get the HTTP version of the URL if your site us using/running on HTTP or you will get HTTPS version of the URL if you have SSL configured site.

function custom_rtawss3_get_attachment_url(){
    return true;
}
add_filter( 'rtawss3_get_attachment_url', 'custom_rtawss3_get_attachment_url', 10 );
  • rtawss3_can_upload_to_bucket

Exclude certain file types (videos for example) from being uploaded to the S3 bucket..


function rtamazon_can_upload_to_bucket( $status, $attachment_id ) {

     // Get the mime type for uploading media.
     $mime_type = get_post_mime_type( $attachment_id );
     $type_arr = explode( '/' , $mime_type );

     // Get media type.
     $type = $type_arr[0];

     // Check if it is video type, then skip uploading to bucket.
     // Other types you can define i.e 'image', 'audio' etc.
     if ( ! empty( $type ) && 'video' === $type ) {
         $status = false;
     }

     return $status;

}
add_filter( 'rtawss3_can_upload_to_bucket', 'rtamazon_can_upload_to_bucket', 99, 2 );