嗨,JoomUnited团队!
这将是为“常规设置”上的“ WP Media Folder Frontend”开关添加角色选择方式的主要功能。
如果有人在等待时正在寻找方法,则可以用替换行号567来更新wp-media-folder.php文件(*)。
原版的 :
567 : $frontend = get_option('wpmf_option_mediafolder');
替换为:
if (!function_exists('wp_get_current_user')) {
include_once(ABSPATH . "wp-includes/pluggable.php");
}
$user = wp_get_current_user();
// Method 1 : create dedicated option
// $auth_roles = get_option('here_custom_option');
// Method 2 : because you need to rewrite this lines after each update perhaps dedicated option isn't needed
$auth_roles = ['administrator', 'other_role'];
if (count(array_intersect($auth_roles, $user->roles)) >= 1) {
//retrieve value only if current user role is in authorized roles list.
$frontend = get_option('wpmf_option_mediafolder');
}
祝你今天愉快
(*)
但每次更新后都会丢失.