Support » Plugin: Namaste! LMS » Role conflict with WPBakery PageBuilder

  • Resolved lardigital

    (@lardigital)


    Everything is up to date.

    I’m using a premium theme bundled with WPBakery PageBuilder.
    I would like to give the ability to the Editor to edit LMS Courses and Lessons.

    If I add the Editor role to the “WordPress roles that can administrate the LMS”, the PageBuilder controls are hidden everywhere in the backend (on Pages, Posts, etc).

    This happens only if I add the role in the Namaste LMS. Otherwise everything works just fine.

    It seems that adding a specific role (instead of leaving only the Administrator able to edit the LMS stuff) breaks the default role handling of WordPress.

    Any help would be appreciated.

    PS. Can’t give access to the staging website because it’s firewalled.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter lardigital

    (@lardigital)

    Update: I’ve cleared the grant for the Editor role in the LMS settings in order to be able to view the PageBuilder interface and – as expected – lost the ability to access to the LSM pages in the backend…

    BUT

    …if I then paste in the addressbar the URL to edit the postID, like

    https://www.mywebsite.it/wp-admin/post.php?post=88285&action=edit&lang=en

    it works, and the PageBuilder interface is ok.
    It seems that adding the Editor role in the LMS somehow messes with the ability to access the post/page list for the LMS custom post type.

    Any suggestions?

    Plugin Author prasunsen

    (@prasunsen)

    The only thing that adding a role in Namaste does is to add “namaste_manage” capability to the role.

    $roles = $wp_roles->roles;			
    			
    			foreach($roles as $key=>$r) {
    				if($key == 'administrator') continue;
    				
    				$role = get_role($key);
    
    				// use Namaste!
    				if(!empty($_POST['use_roles']) and is_array($_POST['use_roles']) and in_array($key, $_POST['use_roles'])) {					
        				if(!$role->has_cap('namaste')) $role->add_cap('namaste');
    				}
    				else $role->remove_cap('namaste');
    				
    				// manage Namaste! - allow only admin change this
    				if($is_admin) {
    					if(!empty($_POST['manage_roles']) and is_array($_POST['manage_roles']) and in_array($key, $_POST['manage_roles'])) {					
    	    				if(!$role->has_cap('namaste_manage')) $role->add_cap('namaste_manage');
    					}
    					else $role->remove_cap('namaste_manage');
    				}	// end if can_manage_options
    			} // end foreach role 

    I can’t imagine how this could break anything anywhere.

    Since the WPBakery PageBuilder does not have a free open source version that we can install to test and try to reproduce the issue the ball goes to them – they can install Namaste and see how adding a capability could break their controls.

    Thread Starter lardigital

    (@lardigital)

    Hi prasunsen,
    I’ve contacted WPBakery and asked them to check what’s going on.

    Thank you for the feeback!

    Plugin Author prasunsen

    (@prasunsen)

    Most welcome. Please do update me if you have this resolved from them. If we have to do something, that’s also fine – I just need to know what.

    Thread Starter lardigital

    (@lardigital)

    Hi Prasunsen,
    after some test with the theme creator (Undsgn – Uncode) here’s what they’ve found out:

    ** findings reply start **

    I have tested and replicated the issue on more than 1 demo installation. Unfortunately, the issue is with the plugin itself.

    It does not just happen with the editor and the builder only disappears when setting the role in Namaste settings. Also, more importantly, it happens with any theme that is activated (which shows it is not an Uncode issue). Switch to a default WordPress theme and see for yourself.

    ** findings reply end **

    Could you please further investigate the issue and fix it?
    I’ve decided to use Namaste after a long research of free and paid themes/plugin and this is the only one that suits my needs.
    The fact is that I can’t nor want give admin rights to our content creator team, for obvious reasons.
    Until this issue persists we can’t use the website at all as I have no time to load all the content by myself and I need to be able to allow the users with the Editor role to do it.

    If I can help you, just let me know.

    Plugin Author prasunsen

    (@prasunsen)

    Could you clarify, what disappears on the default WP theme?

    Thread Starter lardigital

    (@lardigital)

    What disappears are the WPBakery backend buttons inside posts, pages, custom post types.

    To reproduce the issue create a demo website, install wpbakery, install namaste.

    Go in the WPBakery settings and activate the backend editor for any of the following: post, page, custom post type, namaste custom post types.

    Access the Create new post/page and check that the WPBakery backend editor buttons are present and work.

    In the namaste settings add the Editor role to the roles that can create/edit namaste courses/lessons.

    Now access again the Create new post/page and check that the WPBakery backend editor buttons are NOT present anymore.

    I’m the admin of different websites, with different plugins and Namaste is the only one that give me that strange behaviour.
    Other plugins allow to add default roles or even custom roles to achieve the same result I’m trying to get with Namaste but WPBakery doesn’t break.

    I think that maybe the way you add that role is not completely right (even if it seems to, to me) or that it isn’t enough and to make it work there’s also something else to be done.

    I’m telleing you this because it’s clear that the issue is not theme-related as it appears even on the default WordPress themes.
    Neither it’s WPBakery-related as only with Namaste I get this behsviour.

    If there’s something more I could do to help you further investigate just let me know.

    • This reply was modified 1 month, 1 week ago by lardigital.
    Plugin Author prasunsen

    (@prasunsen)

    Well, at the same time there is no other plugin that has any problem with Namaste roles. So it’s still questionable how and why a simple thing like $role->add_cap(‘namaste’) could cause this.

    I am fine to investigate it further but we will need a copy from WPBakery. Their plugin is not available for download.

    Thread Starter lardigital

    (@lardigital)

    I agree with you.
    I apologise if what I wrote seemed to be a pointing finger blaming Namaste it wasn’t my aim.
    Meanwhile, I’ve published a copy of the staging website on the production server (still under construction).
    I can’t get a clean copy of WPBakery (the one I’m using is bundled with the theme) but I can create an admin account for you.

    Does this works for you?

    Plugin Author prasunsen

    (@prasunsen)

    Just looking at a demo won’t help me because I need to debug.
    I found one issue which could be remotely related. Try the version that was just uploaded a minute ago and let me know please.

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