wpmetabox / meta-box

The best plugin for WordPress custom fields and custom meta boxes
https://metabox.io
1.18k stars 423 forks source link

Fix broken access control #1590

Closed tanftw closed 2 weeks ago

tanftw commented 2 weeks ago

E thấy term sẽ visible với tất cả user nên e không fix, không biết có trường hợp nào cần limit không?

Hướng xử lý của e:

Post

User

// This filter accepts two paramters
add_filter ('rwmb_user_query_args_fields', function ($args, $field) {
    return [
        'ID',
        'user_login',
        'user_email',
        'user_nicename',
        'user_url',
        'user_registered',
        'user_status',
        'display_name',
    ];
}, 10, 2);

P/S: Thực ra e thấy config fields qua settings của field hay hơn là dùng filter, nhưng trong phần ajax làm sao lấy được $field qua field id nhỉ? Dùng $field = rwmb_get_field_settings( $field_id ); thì với nhiều loại object_type, post type khác sợ ko chuẩn.