text Creare una cartella riservata in upload con accesso bloccato e solo per utenti loggati

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Creare una cartella riservata in upload con accesso bloccato e solo per utenti loggati相关的知识,希望对你有一定的参考价值。

// PRIMA CREARE CAMPO FILE IN ACF custom field.
// INSERIRE CODICE SOTTO IN FUNCTION.php

#--------------------------------------------------------------------#
// DIRECTORY DIVERSA PER UPLOAD FOTO PROTETTE
# https://www.ractoon.com/2016/08/wordpress-acf-pro-files-field-custom-upload-directory/
#--------------------------------------------------------------------#

add_filter( 'acf/upload_prefilter/name=galleria_fotografie', 'secure_upload_prefilter' );
add_filter( 'acf/prepare_field/name=galleria_fotografie', 'secure_files_field_display' );

function secure_upload_prefilter( $errors ) {

  add_filter( 'upload_dir', 'secure_upload_directory' );

  return $errors;

}

function secure_upload_directory( $param ) {
        
 // $folder = '/s2member-files';

 // $param['path'] = WP_UPLOAD_DIR . $folder;
 // $param['url'] = WP_UPLOAD_DIR . $folder;
 // $param['subdir'] = $folder;
//  $param['basedir'] = WP_UPLOAD_DIR;
//  $param['baseurl'] = WP_UPLOAD_DIR;
    
    
$folder = '/my-special-folder';

  $param['path'] = $param['basedir'] . $folder;
  $param['url'] = $param['baseurl'] . $folder;
  $param['subdir'] = '/';
    
    

  return $param;

}

function secure_files_field_display( $field ) {

  // update paths accordingly before displaying link to file
  add_filter( 'upload_dir', 'secure_upload_directory' );

  return $field;

}

// AGGIUNGERE FILE df-file.php IN ROOT WORDPRESS
// scarica da qui https://gist.github.com/hakre/1552239

// IN HTACCESS AGGIUGNERE LA SEGUENTE RIGA DI CODICE MODIFICATA PERCHE DIRECTORY IN UPLOADS PERSONALIZZATA

RewriteCond %{REQUEST_URI} ^.*wp-content/uploads/my-special-folder/.*
RewriteRule ^wp-content/uploads/(my-special-folder/.*)$ dl-file.php?file=$1 [QSA,L]

以上是关于text Creare una cartella riservata in upload con accesso bloccato e solo per utenti loggati的主要内容,如果未能解决你的问题,请参考以下文章

text Creare IDOC(步骤指南)

text setear una cookie

text Objeto como una superclase

text 得到背景de una clase

text Añadir支持una扩展

text Creando Una Carpeta Desde El Terminal