Support » Plugin: User Role Editor » Bug with User Role Editor and Visual Composer

  • Cameron Barrett

    (@cameronbarrett)


    Ran into an issue today with using this plugin and Visual Composer. It’s not clear to me if this plugin is causing the issue or if it’s VC.

    I noticed that when I change permissions and/or capabilities for a role using URE then the Role Manager settings in Visual Composer for that role lose settings.

    1) User with “Editor” role has access to Visual Composer
    2) Edit “Editor” Role (any capability) and click Update
    3) Users with “Editor” role suddenly have no access to VC because VC Role Manager settings for that role have been reset to default

    I am filing this bug with the developers of Visual Composer as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Vladimir Garagulia

    (@shinephp)

    Thanks a lot for this information.
    I reproduced the described scenario. I will search a reason and return to you with results.

    Plugin Author Vladimir Garagulia

    (@shinephp)

    WordPress itself writes capabilities to the roles with boolean values only. Roles data is stored at the database in a form of PHP serialized array: like this:
    s:10:"edit_posts";b:1;

    Tests showed that ‘Visual Composer’ allows itself to add to the role a capability with not boolean, but string value. We can see at serialized data after click ‘Save’ from Visual Composer Roles Manager:

    
    s:26:"vc_access_rules_post_types";s:6:"custom";
    

    It corresponds to the “Post Types: Custom” choice at Visual Composer Roles Manager.

    User Role Editor interpretes not empty value as a boolean ‘true’, so we still see ‘vc_access_rules_post_types’ capability turned ON, when we load this role. But when we change it, User Role Editor saves all capabilities as boolean values, as they should be. So after updating role with User Role Editor capability data becomes:
    s:26:"vc_access_rules_post_types";b:1;,
    not s:6:"custom" (string ‘custom’) as it was before, but b:1 (boolean true) as it must be.

    As expected when we open VC Role Manager again it does not see ‘custom’ value for ‘vc_access_rules_post_types’ capability and selects at post types dropdown list the 1st available option ‘Pages Only’.

    I think that plugins should not write to the core WordPress data structures any own data types – only types supposed by WordPress core. Capabilities should be boolean always.
    Thus Visual Composer developers should rewrite this part in order to correspond to WordPress core.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.