2017-03-06 11:45:00

Related Docs

Do You Need Help or Expertise?

Is editing Source Code not Your Thing? Are you in a tight Time Schedule and need to deliver a fully scalable and safe solution fast to your Clients?

Maybe you want to incorporate the Software found on TukuToi unbranded and royalty free in your Clients Projects after customizing it as per your Projects requirements?

Or eventually you need some training on any WordPress Plugin, Theme or their creation and maintenance?

FilterDisable Toolset GUI Buttons on FrontEnd TinyMCE Instances

Remove Toolset GUI Buttons from the FrontEnd Forms

Toolset buttons (Fields and Views, Forms, Access) are visible on all TinyMCE Instances, hence as well in FrontEnd Forms using TinyMCE Editor of WordPress (wp_editor), when users with role author+ and when insert media option is enabled in the editor.

You can disable with the following code:

* Remove Toolset buttons on front-end editors
* which appear for role author+ when insert
* media option set on CRED forms
* The filters work globally, so you will need
* to add a test, e.g. for the page where the
* CRED form is added
function remove_toolset_buttons(){

	// $post not available with init hook
	$postID = url_to_postid( $_SERVER['REQUEST_URI'] , '_wpg_def_keyword', true );
	$target_pages = array( 10, 25, 66 ); // Edit for pages with CRED forms

	if ( in_array( $postID, $target_pages ) ) {
		// remove the Fields and Views button
		add_filter( 'toolset_editor_add_form_buttons', '__return_false' );

		// remove the CRED button
		add_filter( 'toolset_cred_button_before_print', '__return_false' );

		// remove the Access button for certain roles
		add_filter( 'toolset_editor_add_access_button', function(){
			$roles = array( 'author', 'subscriber' );
			return $roles;
		} );
add_action( 'init', 'remove_toolset_buttons' );