Support » Plugin: BP Group Documents » Time in filename

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author lenasterg

    (@lenasterg)

    Actually you can’t unless you change the plugin code.
    The time is there to avoid having files with the exact same filename.

    Ah ok that makes sense. If I was to change the code, what would I change?

    Plugin Author lenasterg

    (@lenasterg)

    You have 2 options:
    1. This is the recommented.
    In your custom.php or theme functions.php
    use the following:

    remove_filter('bp_group_documents_filename_in', 'bp_group_documents_prepare_filename');
    add_filter('bp_group_documents_filename_in', 'your_function_for_prepare_filename');
    
    function your_function_for_prepare_filename($file){
    $file = SOMETHING INSTEAD OF TIME() . '-' . $file;
        $file = preg_replace('/[^0-9a-zA-Z-_.]+/', '', $file);
        return $file;
    }

    2. NOT Recommended because in the next plugin update you will lose the change.
    Plugin’s file /includes/filters.php
    in function bp_group_documents_prepare_filename()
    line 15 change the time()
    $file = time() . '-' . $file;
    to what ever you want.

    Bests Lena

    Thanks for that

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Time in filename’ is closed to new replies.