• Hello,

    I have empty capability(do not know how it is happens).
    It is generate checkbox like this

    <div id="ure_cap_div_" class="ure-cap-div ure-custom ure-all">
    <input type="checkbox" name="" id="" value="" class="ure-cap-cb">
    <label for="" title=""> </label>
    </div>

    After role change plugin generate JS error

    Uncaught TypeError: Cannot read property 'removeEventListener' of null
        at HTMLInputElement.<anonymous> (ure.js?ver=5.1.1:554)

    because checkbox do not have ID

    Regards,
    Oleg

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m seeing same problem. Didn’t notice your topic when I made mine … https://ww.wp.xz.cn/support/topic/problem-when-switching-roles-in-main-panel/

    Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    Send a copy of your user roles to support [at-sign] role-editor.com
    To get a serialized value of user roles data use this SQL command:

    
    SELECT * FROM wp_options WHERE option_name='wp_user_roles';
    

    Replace ‘wp_’ with your own database prefix.
    I need data from the option_value field.

    I will look at roles data and add special checking for the empty capability to exclude similar issues.

    Plugin Author Vladimir Garagulya

    (@shinephp)

    Quick fix:
    open user-role-editor/js/ure.js,
    go to the line 547

    
    jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes
    

    and insert this code after it

    
    if (this.id.length===0) {
        return;
    }
    

    Resulting code should be:

    
    jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes
        if (this.id.length===0) {
            return;
        }
        jQuery(this).prop('checked', response.caps.hasOwnProperty(this.id) && response.caps[this.id]);
    
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘JavaScript error on role change’ is closed to new replies.