WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Front-end Editor] Editors not able to edit editable_option

[Resolved] [Plugin: Front-end Editor] Editors not able to edit editable_option

  • Postmatic
    Participant

    @vernal

    Hey Scribu,

    I’m running latest FEE on latest wp. Editors are not able to edit editable_option fields but can certainly edit page content/titles/thumbnails. Admins can edit editable_options without a problem. Ideas?

    Best,
    Jason

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

    @scribu

    That’s because only admins have the ‘manage_options’ capability.

    In the development version, I changed it to ‘edit_themes’ (the same as for text widgets).

    Have you considered using editable_post_meta() instead?

    Postmatic
    Participant

    @vernal

    Ah, ok. Perfect!

    I replaced this:
    <?php editable_option(‘about’); ?>

    With this:
    <?php editable_post_meta(get_the_ID(), ‘about’, ‘textarea’); ?>

    And now it’s great.

    Thanks as always for your help.

    Postmatic
    Participant

    @vernal

    Hey Scribu,

    I’m back on this issue. I yet to come up with a solution that will allow for an editable text block (editable_option) that exists OUTSIDE of the loop yet is editable by editors. I can’t seem to get a good solution going. Ideas?

    Plugin Author scribu
    Member

    @scribu

    The trouble is that editors need to have the ‘edit_themes’ capability.

    In other words, if they can edit widgets, they should be able to edit editable options too.

    Plugin Author scribu
    Member

    @scribu

    If you’re sure that’s not necessary, you can add this code in your theme’s functions.php:

    function my_fee_fields() {
    
    	class Custom_FEE_Field_Option extends FEE_Field_Option {
    
    		function check( $data = 0 ) {
    			extract( $data );
    
    			$cap = ( 0 === strpos( $key, 'editable_option_' ) ) ? 'edit_others_posts' : 'manage_options';
    
    			return current_user_can( $cap );
    		}
    	}
    
    	fee_register_field( 'editable_option', array(
    		'class' => 'Custom_FEE_Field_Option'
    	) );
    }
    
    add_action( 'front_end_editor_fields', 'my_fee_fields' );

    You can replace 'edit_others_posts' with any other capability, if you need to.

    Postmatic
    Participant

    @vernal

    Ok great. In this case there is no problem with the editor having the ability to edit themes, so i turned that on via capability manager and we’re good to go. Thanks for the clarification and the function for future projects.

    Jason

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: Front-end Editor] Editors not able to edit editable_option’ is closed to new replies.