Restrict acces to modules

Hello, how can i restrict access for a custom module?
I have 2 active roles for clients: editor and author. Only the editor has full access to all modules. The author has only limited access to some modules. (i know about author to add capabilities for using BB; that’s done)

The best solution would be that the module is still viewable, but when opening up the settings; some text could be displayed saying: module is not in your subscription plan.

I tried alot with if( current_user_can(‘editor’)); but i have problems with the placement; cause the front-side has to work for not-logged in users; off course.

Can you help me out with some practical demo code how to restrict access to the custom beaver builder modules.

Hey Dave,

I’ve already assigned another member of the team who can assist you with your concern.

Ben

Once the new version drops you should be able to use the ‘fl_builder_register_settings_form’ filter to modify any settings form. I believe you could use if( current_user_can(‘editor’)) to display just a description (your message) and remove the rest of the settings.

Great suggestion Josh! That filter is actually in the latest version, I’m just a bit behind on docs.

Dave, let me test a few things out and see if I can get an example going for you.

Justin

Looking forward to the examples, cause it’s not totally clear to me. Thanks

Hey Dave,

My apologies, I did some testing and it looks like that filter isn’t going to work out after all. The reason is that using that filter would remove all of a module’s registered settings, which would cause errors because the builder needs the settings to render modules.

Unfortunately, I don’t think there is a good solution at the moment that would be available to you. It is possible to disable modules via code, but for now, that will also prevent them from rendering as well. Let me know if that might work for you and I can get an example of that going.

Thanks,
Justin

Thanks Justin, that’s a hard one to figure out, right. Whatever the settings or restrictions, the module must always be rendered for visitors. I’ll look more into this. maybe not in the way of restriction, but more in the way of putting things on display:none by adding a class via javascript when a particular id or module is loaded in the admin…