Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter serferweb

    (@serferweb)

    Hi, in um-actions-user we comment this function, we’re not sure if it was this action to solve the issue or just a miracle so better do this in a test enviroment.. :

    /***
    *** @after user uploads, clean up uploads dir

    add_action(‘um_after_user_upload’,’um_remove_unused_uploads’, 10);
    function um_remove_unused_uploads( $user_id ) {
    global $ultimatemember;

    um_fetch_user( $user_id );

    $array = $ultimatemember->user->profile;

    $files = glob( um_user_uploads_dir() . ‘*’, GLOB_BRACE);

    if ( file_exists( um_user_uploads_dir() ) && $files && isset( $array ) && is_array( $array ) ) {

    foreach($files as $file) {
    $str = basename($file);
    if ( !strstr( $str, ‘profile_photo’) && !strstr( $str, ‘cover_photo’) && !strstr( $str, ‘stream_photo’) && !preg_grep(‘/’ . $str . ‘/’, $array ) )
    unlink( $file );
    }

    }

    }
    ***/

Viewing 1 replies (of 1 total)