Support

Home Forums Event Espresso Premium Remove iFrame Embed Calendar code from EE > Events

Remove iFrame Embed Calendar code from EE > Events

Posted: May 25, 2017 at 2:46 am


ardiaful

May 25, 2017 at 2:46 am

I’ve using this function in my custom plugin to remove the iFrame Embed calendar text and button that is displayed inside EE > Events:


function tw_ee_filter_embed_buttons_output2( $embed_buttons ) {
	//Remove the calendar embed button for all users other than admins.
	if(! current_user_can( 'manage_options' ) ) {
		unset($embed_buttons['calendar']);
  	}
	return $embed_buttons;
}
add_filter('FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', 'tw_ee_filter_embed_buttons_output2', 100, 1);

This function has been working fine for a while, however I recently noticed the iFrame text and button appears again. I have not made any changes in members permissions for manage_options. Please help to remove this again.


Tony

  • Support Staff

May 25, 2017 at 3:18 am

Hi there,

I just tested the snippet on a new test site to confirm it still works and didn’t run into any problems.

Where do you currently have that code on your site?

The capability check is for manage_options which only admins would normally have, so are you viewing the page using an admin account or another role?


ardiaful

May 25, 2017 at 6:37 am

the code is in my custom.php plugin

users do not have manage_options enabled.

I’m viweing the page using a user role other than administrator.


Josh

  • Support Staff

May 25, 2017 at 7:38 am

You could make sure that your custom plugin is activated.

You can also remove the caps check and remove the calendar button for everyone:

function tw_ee_filter_embed_buttons_output2( $embed_buttons ) {
  unset($embed_buttons['calendar']);
  return $embed_buttons;
}
add_filter('FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', 
  'tw_ee_filter_embed_buttons_output2', 100, 1);

Finally, there’s a second iframe embed button that’s for embedding an upcoming events list (not the same as the calendar). You can remove both buttons by changing the code to be:

add_filter(
'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', 
  function(){return;},
 100, 1);

The support post ‘Remove iFrame Embed Calendar code from EE > Events’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso