This is bit of a strange one.
To store individual user data files I am programatically changing the upload folder for each logged in user (e.g.
/wp-content/user_data/atest2 - for the user
In doing this I have discovered that Beans creates a folder (Beans) within the user's folder containing compiler files.
Is it possible for me to ask Beans to not do that? Create it elsewhere?
We use to have a filter for it but it is depreciated as it wasn't a stable solution in some cases (mosty due to directory permission issues).
That said I don't think changing the upload folder path for each user is the right approach. The upload folder is used by WordPress Core but also by themes and plugins. For example, some caching plugins will add their cached files and memecache. Aslo, we could WP add more directories or files in the future, who knows.
The way you have it at the moment is quite "dangerous" because things are going to be added for each users without you having control over it. What I would suggest to do is to keep full control and not change the upload dir globally. Instead, you only change it for the stuff you want to be in a specific folder per user.
May I ask what needs to be user specific?
Hi Thierry, I am only changing it momentarily while a user uploads some files. It is then immediately set back. Even so, the beans compiler folder is immediately created as soon as I change it. I was doing this so that I could use a plugin that uses very nice AJAX upload functionality. However, it's turned out to be a bit of a pain so I'm looking at others. Maybe I won't have to change the upload folder at all with the next one I try?
It's for a website where members can save their 'memories'. Some of which being photos, audio and video etc.
Hi Thierry, I am only changing it momentarily while a user uploads some files. It is then immediately set back. Even so, the beans compiler folder is immediately created as soon as I change it.
Beans assets only fire when
wp_enqueue_scripts is called so your code doesn't seem to execute the way you planned. Could you please share your code here on via a Gist so that I can see how you are changing the upload path to the client folder and back.
A better approach would be to set the path to the client directory whithout modifying the global upload path (doesn't really make sense to do so).
It would really help if you could share you plugin/theme app to see all the steps. It is also very important to take security in consideration when allowing users to upload files to your server 😉
Hi Thierry, My mistake, I was changing the default folder without checking for a specific page/template. When I added that Beans did not create the compile files in the new folder.
I have decided that I am not going to change the default folder at all. I was only really doing that so I could try and use existing plgins for file uploading. None of the ones I tried offered everything I needed so I'm writing my own. I have been reading up on the security side of this and will be ensuring that I build in all the safety procedures that I am able to implement. I am aware how important that is.
Thanks for your help.
Great, thanks for sharing 🙂