• Resolved davask

    (@davask42)


    Hi,

    I m updating the permissions on user role which belong to Project Panorama Lite or Ultimate Member and they do not want to update their data.

    Actualy, it works but after like 1 or 2 seconds the data is back to previous value !!!

    Any idea how can I debug this ?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    WordPress default model of a work with roles: create roles on setup and forget about them.
    A lot of plugins including very popular like WooCommerce and others create its roles on plugin activation.

    Created roles are stored at WordPress database and this fact makes possible to change them with help or User Role Editor or similar plugins.

    Project Panorama Lite plugin uses ‘admin_init’ event to re-create its roles. Thus it executes its roles creation code for every page opening at wp-admin.
    Look at the file project-panorama-lite/lib/psp-helpers.php file, line #632:

    
    add_action( 'admin_init', 'psp_add_project_roles' );
    

    and line #697:

    
    add_action('admin_init','psp_add_role_caps',999);
    

    This is a reason why changes you try to make to PPL plugin roles are reverted back.

    Plugin Author Vladimir Garagulya

    (@shinephp)

    Ultimate Member plugin works with its roles similar way as a PPL plugin. It just use a different event in order to initialize its own roles:
    Look at the file ultimate-member/includes/core/class-role-capabilities.php, line #22:

    
    add_action( 'wp_roles_init', array( &$this, 'um_roles_init' ), 99999 );
    

    ‘wp_roles_init’ event fires for every page opening. Thus it does not have sense to modify such role stored at the WP database. UM plugin will modify it back on the page load.

    Plugin Author Vladimir Garagulya

    (@shinephp)

    The only workaround is to write code which will be executed after such plugin roles refresh code and modify them as needed to you.

    Thread Starter davask

    (@davask42)

    Hi Vladimir,

    thank you so much for the explanation.
    I actually created roles from your plugin instead of using Ultimate member for instance, using my own naming convention and it works as expected so no need to overwrite code ??

    Thanks,

    you made my day ??

    david

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘User role settings are not saved’ is closed to new replies.