You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#103684 Specific Folder for user custom field

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by SigridGR on Monday, 30 March 2020 22:37 BST

SigridGR
Hi,

I have multiple JCE Editor User Profiles with different folders they use - this works great.
like here https://www.joomlacontenteditor.net/support/tutorials/editor/setting-the-file-directory-path

However, I have user images (like profiles images). This user custom field is a JCE media field.
So only for this specific field I want to use a specific folder per user:
like images/users/$user
There will be the user image for each single user.
There is no component I can use for this setup in the profile.

Or, how could I do the setup here? Because in the custom field setup I also cannot choose a profile to use.

Thanks!
Sigrid

Ryan
I've been looking into this today and I can't find an effective way to do it via a JCE Profile. The only viable option I think is to tak advantage of JCE Filesystem Events via a Joomla plugin, and manipulate the root directory value based on certain parameters. JCE Filesystem Events are events that are triggered before and after some filesystem functions, like upload delete etc. An example plugin containing all the available events is here - https://github.com/widgetfactory/wf_filesystem_events In your instance you could do something like:

class PlgSystemWf_filesystem_events extends JPlugin
{
    /**
     * onWfFileSystemGetRootDir
     * @param   string  $path  The relative root directory path, eg: "images".
     * @return  void
     */
    public function onWfFileSystemGetRootDir(&$path)
    {
        $app = JFactory::getApplication();
        $user = JFactory::getUser();

        // into images field file browser...
        if ($app->input->getCmd('fieldid') === 'jform_images_image_intro') {
            // append the username to the current root file directory path
            $path .= '/' . $user->username;
        }
    }
}

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

SigridGR
Great! Thanks!
I used your plugin template from github and adjusted it to my needs.
It works great!

Thanks a lot!
Sigrid