• 0

How do i remove "Custom Scripts"


Question

Posted · Report post

Hey guys, 

I'm using pagelines 1.1.5 at the moment,

 

How can i remove the "Custom Scripts" menu item or feature.

I don't want to allow users to add their own custom javascript or HTML for security reasons.

I've tried editing the panel.code.php file and also used the "PageLines DMS Toolbar Customizer" which didn't work.

Pagelines doesn't load when unsetting the custom design menu item with this plugin either.

 

How can i do this whilst still having custom css/less.

 

Thanks guys

 

Share this post


Link to post
Share on other sites

5 answers to this question

  • 0

Posted · Report post

Hi Casey

 

Did you use the latest version of that plugin, there is an older one still available on the website as well. This is the newer one - http://www.pagelinestheme.com/remove-dms-editor-toolbar-items-2/

 

If you want them to still have access to the DMS control panel, just not the css/less tab, then looking at the code on the plugin site you can use a hook. http://www.pagelinestheme.com/remove-dms-editor-toolbar-items-2/

 

add_filter('pl_toolbar_config','pagelines_dms_toolbar_customizer',11, 2);
function pagelines_dms_toolbar_customizer( $toolbar ){
if(
        !current_user_can('manage_options') // the uncommented items below only get removed for non-Administrators who also have access to the PageLines DMS Editor
        //&& get_current_user_id() !== '1' // could also choose to limit to certain Administrators via user ID
    ){

unset( $toolbar['pl-design']['panel']['user_less']);

    }
 
    return $toolbar;
}

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I did try that but couldn't manage to get it working,

My users are all Administrators, i think that plugin only 'works' when a non-admin tries to access the dms editor? 

 

How could i make it work for all user privileges including Administrator? 

 

Thanks for all your help mate :)

Really appreciate it!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Update:

 

So i managed to get it working by removing 

 

 if(
		!current_user_can('manage_options') // the uncommented items below only get removed for non-Administrators who also have access to the PageLines DMS Editor
		//&& get_current_user_id() !== '1' // could also choose to limit to certain Administrators via user ID
	){

When unsetting the Custom scripts tab/menu, pagelines never loads, it just stalls on the loading screen.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Can you paste the code you have which causes DMS to never load please.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

unset($toolbar['pl-design']);		//Custom Code
			unset( $toolbar['pl-design']['panel']['user_less']);		// Custom -- Custom LESS/CSS
			unset( $toolbar['pl-design']['panel']['user_scripts']);		// Custom -- Custom Scripts

That's the lines there that cause Pagelines to not load.

Everything else can be unset with no problems. Just this menu item. Which is fine if it weren't such a security risk with JS n html

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now