WordPress.org

Ready to get started?Download WordPress

Forums

WYSIWYG Widgets / Widget Blocks
Option to decide menu location and user role (9 posts)

  1. GermanKiwi
    Member
    Posted 4 months ago #

    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).

    http://wordpress.org/plugins/wysiwyg-widgets/

  2. Danny van Kooten
    Member
    Plugin Author

    Posted 4 months ago #

    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.

    Example

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

    Good enough?

    Thanks!

  3. GermanKiwi
    Member
    Posted 4 months ago #

    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!

    Thanks!

  4. GermanKiwi
    Member
    Posted 4 months ago #

    Hi Danny! I'd love to hear back from you about this sometime! :)

  5. Danny van Kooten
    Member
    Plugin Author

    Posted 3 months ago #

    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!

  6. GermanKiwi
    Member
    Posted 3 months ago #

    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).

  7. Monika
    Member
    Posted 1 month ago #

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

  8. Danny van Kooten
    Member
    Plugin Author

    Posted 1 month ago #

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

  9. Monika
    Member
    Posted 1 month ago #

    Hi Danny

    thanks a lot!

    Monika

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.