Support » Plugin: Widget Content Blocks » Option to decide menu location and user role

  • Hi, I really like this plugin and how it works – makes it a lot easier to create and customise my widgets!

    I noticed that you recently changed the plugin to allow Editor roles to access the widgets, and also moved it to the Pages section of the menu rather than under Appearance.

    For myself, I actually much prefer it how it was before! 🙂 On my site, widgets are solely a function of the site’s design, which should therefore be accessible only by the web designer (ie. myself, the administrator) – and not by the editors. The editors only deal with content, not layout or design. I don’t want the editors being able to delete or modify any widget as that could damage or negatively alter the layout of the site.

    Therefore I’d much rather have the menu located within “Appearance”, which for me is the more logical place (that’s where the “Widgets” sub-menu is already located), and also restricted to Admins only.

    I know that other users of your plugin won’t like that – it’s obviously a matter of preference. Maybe there could be a setting somewhere which lets us choose this functionality for ourselves? (Both the menu location and the user role accessibility).

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Danny van Kooten


    Hi again,

    Again, good suggestion. Would it suffice to allow changing the default role through a filter function (a line of code you can add to your theme its functions.php file).

    For the majority of users, the current role is perfectly fine. I don’t want to bother them with an option they will never need. For the people who do want to change the default role, a simple line in their functions.php file will do.


    function my_widget_blocks_role() { return 'administrator'; }
    add_filter('widget_blocks_role', 'my_widget_blocks_role');

    Good enough?


    Is this supposed to work already, or is it pending the next version of the plugin?

    I just added this code to my functions.php file but it hasn’t changed anything – I can still fully access the Widget Blocks from an account with the Editor role.

    Additionally, the menu item hasn’t moved to the Appearance section of the menu either.

    Would you be willing to consider switching the behaviour around? So that the default behaviour is for the plugin to be restricted to Admin, and located inside the Appearance menu – and then the function.php code is used to move the menu and enable access to other user roles.

    In my opinion it makes more sense for the plugin to default that way, because widgets by default are an admin-only feature – eg. the Widgets page itself sits inside the Appearance menu and is only accessable by the Admin role, and other widget plugins such as WooSidebars also behave in the same way. It doesn’t make much sense to allow non-admins to create widget blocks when they can’t actually do anything with those blocks that they create – they can’t add the blocks to a sidebar because they can’t access the Appearance->Widgets page.

    Therefore I think it makes more sense for the plugin to behave that way by default, and then for those few users who do need to give access to non-Admins, they can use the function.php code to override the default behaviour. (This also means for the rest of us, we don’t have to add extra code to our function.php file).

    What do you think?

    In any case, the code you’ve given me above doesn’t seem to work right now, so let me know what I can do to troubleshoot this!


    Hi Danny! I’d love to hear back from you about this sometime! 🙂

    Plugin Author Danny van Kooten


    Hi there,

    Sorry for my somewhat late reply, been crazy busy. No, that code was not supposed to work yet – it was just an example to see if that would suffice.

    I’d have to put some thought into changing it around because a lot of users updating won’t like the fact that they have to add code to their functions.php to “make the plugin work again”.

    I am currently working on the feature to change the menu location and role needed to access the widget blocks. You can expect an update somewhere during the holidays.

    Thanks again, great suggestions!

    Sounds good. I guess it depends really on how many users actually would want to give non-admins access to this plugin. My expectation would be that the majority of users would only want the admin role to access the plugin, because widgets are normally an admin feature, but you obviously have the best idea of what your users want. 🙂

    Maybe it’s an idea to just add a setting within the plugin’s GUI directly, which controls this. Eg. add a Settings sub-page or tab, which has one option for menu placement (either inside the Appearance menu, or directly at the root level), and another option for user role (Admin/Editor etc). That way nobody has to put anything into the functions.php file. (And I have seen other plugins do exactly this – they provide a setting which controls where the plugin’s menu goes).

    if it is possible to restrict your plugin per role this would be absolut stunning 🙂
    So I bump this feature rquest .-)

    Plugin Author Danny van Kooten


    Not yet Monika, sort of forgot about this. Sorry. Will try to have a shot this weekend!

    Hi Danny

    thanks a lot!


Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Option to decide menu location and user role’ is closed to new replies.