Change WordPress user roles and capabilities › Forums › Bug Reports › Incorrect Capabilities Checked › Reply To: Incorrect Capabilities Checked
17/08/2018 at 20:00
#5085
TownNews.com
Participant
The affected JavaScript looks like this:
jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes
jQuery(this).prop('checked', response.caps.hasOwnProperty(this.id));
});
But should be more like:
jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes
if (response.caps.hasOwnProperty(this.id) && response.caps[this.id]) {
jQuery(this).prop('checked', true);
} else {
jQuery(this).prop('checked', false);
}
});
This correctly checks boxes with true
values and unchecks boxes with false
values.