Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter rampaaa

    (@rampaaa)

    I solved the problem by changing the function “buddydrive_save_new_buddyfile()” in buddydrive-item-ajax.php

    You shouldn’t edit a plugin’s file. Next upgrade will remove your customization.

    I’ll look at a way to allow you do this from a bp-custom.php file for example.

    Hi this will be possible in next version (1.2.2)

    You’ll then need to use this code :

    function rampaaa_custom_errors( $upload_error_messages = array() ) {
    	return array(
    		20 => __( 'Your file need to contain the word "magic"' ),
    	);
    }
    add_filter( 'buddydrive_get_upload_error_strings', 'rampaaa_custom_errors', 10, 1 );
    
    function rampaaa_check_filename( $file = array() ) {
    	if ( ! empty( $file['name'] ) && false === strpos( $file['name'], 'magic' ) ) {
    		$file['error'] = 20;
    	}
    
    	return $file;
    }
    add_filter( 'buddydrive_upload_errors', 'rampaaa_check_filename', 10, 1 );

    I should release 1.2.2 in a couple of days.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Check file name’ is closed to new replies.