• Resolved reflectgrowth

    (@reflectgrowth)


    Would be awesome if this plugin could store the cover images in a defined location that would enable inclusion / exclusion for CDN rules.

    E.g. look at avatars: users – “wp-content/uploads/avatars” or groups – “wp-content/uploads/group-avatars”. In this model these paths can explicitly be used to include / exclude these images from use on a cdn.

    As it stands, the cover images are pulled directly from the relevant uploads/year/month/ which make them hard to include / exclude specifically within the cdn push / pull rules sets.

    ^Matt

    https://www.ads-software.com/plugins/buddypress-cover-photo/

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

    (@reflectgrowth)

    Maybe even use:

    users: wp-content/uploads/covers/<user_id>/<img_name>
    groups: wp-content/uploads/group-covers/<group_id>/<img_name>

    Plugin Author SeventhQueen

    (@seventhqueen)

    Hi, it is a bit tricky to implement it now since it is already being used in production but we will try to think of a way to do it.

    Thanks

    Plugin Author SeventhQueen

    (@seventhqueen)

    You can try adding this in your child functions.php

    add_filter('upload_dir', 'bcp_custom_upload_dir' );
    
    function bcp_custom_upload_dir($args) {
        if (isset($_POST['action']) && $_POST['action'] == 'bp_upload_profile_cover' ) {
            $args['path'] = $args['basedir'] . "/bcp-user" . $args['subdir'];
            $args['url'] = $args['baseurl'] . "/bcp-user" . $args['subdir'];
        }
        if (isset($_POST['action']) && $_POST['action'] == 'upload_group_cover' ) {
            $args['path'] = $args['basedir'] . "/bcp-group" . $args['subdir'];
            $args['url'] = $args['baseurl'] . "/bcp-group" . $args['subdir'];
        }
        return $args;
    }
    

    This should make the uploads for the profile cover in a bcp-user folder and the group cover in a bcp-group folder

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Defined storage for CDN rules’ is closed to new replies.