Nó sẽ là tính năng hàng đầu để thêm vai trò được chọn theo cách được chọn cho công tắc " Frontend WP Media Folder " trên Cài đặt chung.
Nếu ai đó đang tìm kiếm một phương pháp trong khi chờ đợi, bạn có thể cập nhật tệp wp-media-folder.php (*) bằng cách thay thế dòng số 567
Nguyên :
567 : $frontend = get_option('wpmf_option_mediafolder');
Thay thế bởi :
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');
}
Chúc một ngày tốt lành
(*) nhưng bị mất sau mỗi lần cập nhật.
- Trang :
- 1