• Hello, I’d like to know if the plugin is compatible with external file storage system like Amazon S3.

    We are using S3-Uploads plugin (by HumanMade) to manage uploads on S3. This plugin uses WP filters to replace the standard uploads folder with a folder hosted on S3.

    Theoretically, if Customer Area uses standard WP filters and functions to managa private files there could be a good chance of compatibility.

    Please can you confirm if Customer Area support such kind of service?

    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Thomas

    (@tlartaud)

    Hello,

    As we never tested this plugin, we cannot guarantee its compatibility with WP CustomerArea.

    Also, WP CustomerArea does not use the standard WP uploads folder, except for images inserted from the frontend rich editor, if you use the Front Office Publishing add-on.

    To ensure more security about private files attachments, we store them in another folder (wp-content/customer-area/storage) which should normally be moved outside of your webroot.

    However, WP CustomerArea gives access to tons of hooks and filters that should allow you to move those folders to the upload folder, and then let them be synced to your s3. I guess that this plugin is actually hooking into the wp_uploads_dir() function to detect which plugin is using that folder. It means that you could hook into any of our filters, and change the paths to our storage folder to something using the wp_upload_dirs() function. As you can see in the “securing private files” documentation, the relevant hook to change the path of the storage folder is the following: cuar/core/ownership/base-private-storage-directory

    It means you could probably write a custom code snippets like the following, in a custom plugin:

    /**
     * Change the location of the WPCA storage folder by using the wp_upload_dir() function, in order to probably ensure
     * compatibility with S3-Uploads plugins
     *
    * @param $dir string Current path the storage dir folder
    * @return string
     */
    function wpca_move_storage_folder_to_uploads_dir($dir)
    {
    	$uploads_dir = wp_upload_dir();
    
    	return $uploads_dir['basedir'] . '/customer-area/storage';
    }
    add_filter('cuar/core/ownership/base-private-storage-directory', 'wpca_move_storage_folder_to_uploads_dir');

    Note 1: it will be up to you to secure the HTTP access to this folder (to prevent anyone to be able to directly access files if they’re aware of their URLs).

    Note 2: This will move the main storage folder (wp-content/customer-area/storage), but not others custom folders located in wp-content/customer-area, such as templates, languages or ftp-uploads.

    Regards.

    Plugin Author Thomas

    (@tlartaud)

    If you try to use the above code snippet, please first edit the following files in the plugin’s files (I found a little hook naming issue that could conflict with the one I mentionned in my initial answer).

    Edit file customer-area/src/php/core-addons/post-owner/post-owner-addon.class.php, line 283 and change:

    $dir = apply_filters('cuar/core/ownership/base-private-storage-directory', $dir);

    to:

    $dir = apply_filters('cuar/core/ownership/legacy-base-private-storage-directory', $dir);

    Regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Compatibily with S3?’ is closed to new replies.