• Resolved modesix

    (@modesix)


    Is there a way to disable this plugin on a specific page or post? It seems to interfere with form elements, specifically form post method, so it is making my integrated forum unusable.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author scribu

    (@scribu)

    Try the development version (2.0-alpha3). It should not interfere with form controls anymore.

    I need the exact same thing — there’s one page that FEE is allowing admins to edit from the front end that’s causing problems, but I can’t figure out how to defeat FEE on only that specific page. I followed the link above to the development version but it seems to lead to the public release version…any ideas?

    Plugin Author scribu

    (@scribu)

    I hope you mean disable. “Defeat” sounds so confrontational. ??

    Just place this code in your theme’s functions.php:

    function fee_disable( $allow, $args ) {
    	$disabled_post_ids = array( 101, 102 );
    
    	return $allow && !in_array( $args['post_id'], $disabled_post_ids );
    }
    add_filter('front_end_editor_allow_post', 'fee_disable', 10, 2);

    Of course, you have to replace 101, 102 with your own post id(s).

    Thank you so much Scribu! I’ll test that later today.

    I’m having a similar problem I think, I keep getting this error: Warning: Missing argument 2 for FEE_Field_Category::wrap() in filepath…etc.

    But it only happens on a few pages, all of which are using the TDO Mini Forms plugin to display a form. I’m sure that’s the problem and simply want to disable front end editing on those pages. I added the code posted above to my functions file, but it doesn’t do anything. Do I need to add an add_action or somehow call the function to make it work? If so, where and what variables am I passing in?

    Thanks!

    Okay, found another way to do what I want. I found this post on the plugin website: https://scribu.net/wordpress/front-end-editor/loading-only-on-certain-pages.html

    Made a slight modification to the code given there and it works great for my purposes:

    function front_editor_disable() {
    if ( is_page() )
    return true;
    }
    add_filter(‘front_end_editor_disable’, ‘front_editor_disable’);

    Since all the problem areas of my site are pages rather than posts. Would still love be able to pick specific posts / pages, but this works fine for me for now. Thanks!

    close, this one works for me with the latest version like a charm:

    function front_editor_disable() {
    if ( is_page(*pageid*) )
    return true;
    }
    add_filter(‘front_end_editor_disable’, ‘front_editor_disable’);

    or can you use a custom field to fill in the page id?
    best regards!

    Plugin Author scribu

    (@scribu)

    or can you use a custom field to fill in the page id?

    You can do something like this:

    Disable Front-end Editor if the current page has a ‘fee_disable’ custom field:

    function front_editor_disable() {
      global $wp_query;
    
      if ( is_page() && get_post_meta($wp_query->posts[0]->ID, 'fee_disable', true) )
        return true;
    }
    add_filter('front_end_editor_disable', 'front_editor_disable');

    thanky you scribu – this is awesome!

    this snippet works for posts too:

    function front_editor_disable() {
    global $wp_query;
    if ( is_page() && get_post_meta($wp_query->posts[0]->ID, 'fee_disable', true) )
    return true;
    if ( is_single() && get_post_meta($wp_query->posts[0]->ID, 'fee_disable', true) )
    return true;
    }
    add_filter('front_end_editor_disable', 'front_editor_disable');

    whenever the custom field is “true” no editing is possible.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Front-end Editor] Disable on specific pages?’ is closed to new replies.