• Resolved shawfactor

    (@shawfactor)


    bp_attachments_get_src() uses bp_upload_dir it should use bp_attachments_uploads_dir_get to consistent and allow for the fact that bp_attachments_uploads_dir_get can be filtered.

    This is a better approach

    function bp_attachments_get_src( $filename = '', $path = '' ) {
    	$src       = '';
    	//$uploads   = bp_upload_dir();
    	$uploads   = bp_attachments_uploads_dir_get();
    	$file_path = trailingslashit( $path ) . $filename;
    
    	if ( file_exists( $file_path ) && 0 === strpos( $file_path, WP_CONTENT_DIR ) ) {
    		$src = str_replace( $uploads['basedir'], $uploads['baseurl'], $file_path );
    	}
    
    	return $src;
    }

    • This topic was modified 2 years ago by shawfactor.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘bp_attachments_get_src usues wrong function’ is closed to new replies.