Hello,
I’m sorry, I don’t think I understand when you said back up the filter hook in the theme.
If you are referring, I should put it in the theme ‘function.php’ , it already is.
If you are referring to priority it already has a priority of 2, but that doesn’t matter if the “apply_filters” is used after the variable is initialized.
So yea, I the problem can’t be rezolve at the function.php level or other level. The problem is in the you’re plugging code and that is the position of apply_filters from the root function.
So the only fix possible is puting
$userRootExt = apply_filters('wpdm_asset_manager_root', $userRootExt, $path);
above
$realUserRootExt = realpath($userRootExt);
you can even start with the apply_filters in the root function
But I can’t do anything to it, you just have to change the position in the next update.
It’s that simple.
P.S.
you have 3 codes that dose the same thing in function root
$userRootExt = preg_replace(array('/\.\.\//', '/\.\//', '/\/\.\.$/'), "", $userRootExt);
static function fsPath($path)
{
$path = str_replace("\\", "/", $path);
if(is_dir($path)) $path = trailingslashit($path);
return $path;
}
$realUserRootExt = realpath($userRootExt);
one eliminates the backslash and the “go back one directory”
the other eliminates again backslash
and the other tells you ”
@return string the canonicalized absolute pathname on success. The resulting path
* will have no symbolic link, ‘/./’ or ‘/../’ components. Trailing delimiters,
* such as \ and /, are also removed.
”
Aren’t they kind of the same thing?
Hello,
I think i found the problem you guys putted the filter only on $userRootExt variable and forgot about $realUserRootExt.
So the filter is changing the path in Assets Manager only for one variable in the if statement
$userRootExt = apply_filters('wpdm_asset_manager_root', $userRootExt, $path);
if(substr_count($userRootExt, $userRoot) == 0 || !$realUserRootExt || substr_count($realUserRootExt, $userRoot) === 0) return "[INVALID_PATH]";
So when in my filter I’m saying that the user should have the base root changed it applies only for $userRootExt
So in my case the base root in the manage option is set /home/something/
But in my filter I set it to /home/something/user_category/ and the function root
public static function root($path = '')
{
if(!function_exists('get_home_path'))
include_once ABSPATH.'wp-admin/includes/file.php';
$current_user = wp_get_current_user();
$fbRoot = get_option('_wpdm_file_browser_root');
if(!$fbRoot) $fbRoot = get_home_path();
$userRoot = current_user_can(WPDM_ADMIN_CAP) ? trailingslashit($fbRoot) : trailingslashit(UPLOAD_DIR . $current_user->user_login);
//Create user root if dir doesn't already exist
if(!current_user_can(WPDM_ADMIN_CAP) && !file_exists($userRoot))
{
@mkdir($userRoot, 0775, true);
FileSystem::blockHTTPAccess($userRoot);
}
$userRoot = self::fsPath($userRoot);
$userRootExt = $path !== '' ? $userRoot.$path : $userRoot;
$userRootExt = preg_replace(array('/\.\.\//', '/\.\//', '/\/\.\.$/'), "", $userRootExt);
$realUserRootExt = realpath($userRootExt);
if($realUserRootExt) $realUserRootExt = self::fsPath($realUserRootExt);
$userRootExt = self::fsPath($userRootExt);
$userRootExt = apply_filters('wpdm_asset_manager_root', $userRootExt, $path);
if(substr_count($userRootExt, $userRoot) == 0 || !$realUserRootExt || substr_count($realUserRootExt, $userRoot) === 0) return "[INVALID_PATH]";
if (is_dir($userRootExt)) $userRootExt = trailingslashit($userRootExt);
return $userRootExt;
}
from AssetManager.php, doesn’t count for the changing root.
So the variable $userRootExt will have /home/something/user_category/folder/
While $realUserRootExt will have /home/something/user_catogory/user_category/folder/
because for him user_category/folder/ is the path and the root is /home/something/
Because the filter is placed after the initialized of the variable
$realUserRootExt = realpath($userRootExt);
if($realUserRootExt) $realUserRootExt = self::fsPath($realUserRootExt);
$userRootExt = self::fsPath($userRootExt);
$userRootExt = apply_filters('wpdm_asset_manager_root', $userRootExt, $path);
After i changed the position to
$userRootExt = apply_filters('wpdm_asset_manager_root', $userRootExt, $path);
$realUserRootExt = realpath($userRootExt);
if($realUserRootExt) $realUserRootExt = self::fsPath($realUserRootExt);
$userRootExt = self::fsPath($userRootExt);
it works.
Hello,
And thank you for adding a filter to the root of assets.
It works perfectly.
Thank you.
Hello,
we can give you access to our dev server, but we will need a chat system so I can add de IP to htaccess and remove it afterwards.
P.S. Our UTC is +3.
Thank you.
Thank you very much.
I will look forward to the hook, in the next update.
Hello,
And if I may add it will be more useful if I see in Import/Export tab at the category filter the category in a tree view style.
https://github.com/clivezhg/select2-to-tree
and in the metabox of category when I add a package and choose the category. Because I have soo many category with the same name but different parent category.
Thank you in advance.
Hello,
We deactivated the other plugins , and the problem still persist.
Hello,
I am sorry, but we cant allow you to enter in the site, for security reason.
it seems there’s some ajax failure. If I browser the folder one by one , sometimes I cant see the files, but if I browser a folder, then an empty folder, then the next folder, I see all the files.
The problem is when I try to import the files some files doesn’t get imported.
In the console I get
{
“key”: “b5961e33e9b452c8d2ce61b1a264b484”,
“type”: “notice”,
“message”: “Undefined index: category”,
“file”: “wp-content/plugins/download-manager/src/Admin/Menu/ImportExport.php”,
“line”: 401,
“stack”: [
“WPDM\\A\\M\\ImportExport->importDirFile()”,
“do_action(‘wp_ajax_wpdm_dimport’)”
],
“component”: “Plugin: download-manager”
}
(anonymous) @ query-monitor.js?ver=1651149785:385
In the php error log it shows :
[ERROR] : WP_CACHE constant is not present in wp-config.phpPHP message: [ERROR] : WP_CACHE constant is not present in wp-config.php’, referer: https://insp.gov.ro/wp-admin/edit-tags.php?taxonomy=wpdmcategory&post_type=wpdmpro&paged=3
And when I work in the site it seems that it slowing my site, because it uses the same table as post, and I have a lot of files and folder that should be use by the plugin.
Thank you.