When using Groups File Access with WP in a trellis bedrock structure, we are needing to amend the wp_groups_file path field after every deploy

When we deploy any changes to our WP installation, then the current release folder changes from for eg

/srv/www/echamicrobiology.com/releases/20250114142147/web/app/uploads/groups-file-access
to
/srv/www/echamicrobiology.com/releases/20250114124233/web/app/uploads/groups-file-access

This means we cannot then access the files unless we do an update in the database which isn’t convenient.
Is there a way around this please?


Comments

5 responses to “When using Groups File Access with WP in a trellis bedrock structure, we are needing to amend the wp_groups_file path field after every deploy”

  1. Hey Delyth,

    That’s actually pretty weird because via the small plugin I’ve shared, this runs earlier than functions.php.
    Let me have another look in case I’m missing something obvious.

    Cheers

  2. Dev Elopers Avatar
    Dev Elopers

    Hi George
    Thanks so much for your input again.

    But I’m sorry that didn’t work either, that was more or less doing the same as my edit to the functions.php file.

    I’ve now edited your plugin to return the uploads dir that I need, so it’s now working. I will have to remember though to redo the amend after any future upgrades.

    Thanks again
    Delyth

  3. Hi Delyth,

    Why don’t you try this little plugin I’ve created here:
    https://github.com/geotsiokos/gfa-uploads-dir
    Tested and works properly, while the only missing thing for you would be to define your upload DIR.

    Kind regards,
    George

  4. Dev Elopers Avatar
    Dev Elopers

    Hey George
    Thanks for you suggestions.
    I’ve tried using the filter groups_file_access_uploads_dir by adding this to my functions.php file
    add_filter( ‘groups_file_access_uploads_dir’, function() {
    return ‘/srv/www/echamicrobiology.com/current/web/app/uploads/groups-file-access’;
    }, 10, 1 );
    But still not working.
    I can get it to work if I directly edit the plugin so that this
    define( ‘GFA_UPLOADS_DIR’, gfa_uploads_dir() );
    is changed to this
    define( ‘GFA_UPLOADS_DIR’, ‘/srv/www/echamicrobiology.com/current/web/app/uploads/groups-file-access’ );

    So I must be missing something in how I’m trying to use the filter.

    Do you have any other advice please?

    Many thanks & regards

    Delyth

  5. Hi there,

    Welcome to our support forum for Groups File Access and many thanks for choosing our solution for restricting access to files.
    What you get is expected, since the absolute path to each file changes to something other than what is stored in the db.
    I think you should give a try to the filter hook apply_filters( ‘groups_file_access_uploads_dir’, $gfa_uploads_dir ); which returns the string path to your files upload dir. Perhaps with that hook you can specify a path for files above the level that changes, so that the location would remain intact after each new release. Obviously after defining the new custom path, you should once more change the file paths in the database.
    Hope it helps.

    Kind regards,
    George

Only authorized members can comment on this topic.

Log in

Share