WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] Custom fields aren't editable. (10 posts)

  1. Kahil
    Member
    Posted 2 years ago #

    I have the plugin installed and nothing is editable. I have it set so that only custom fields can be edited. I have php 5. There are no other errors with my theme. Simply isn't working. That's a shame...I really wanted to have a way to let my users edit some fields once they log in rather than having htme mess with things in the back end.

    Hope this gets resolved soon.

    http://wordpress.org/extend/plugins/front-end-editor/

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

  3. Kahil
    Member
    Posted 2 years ago #

    like I said, there are no mistakes in my theme...been doing this for a while now.

    I eventually got it work by editing the plugin manually. unfortunately the plugin doesn't play will with the plugin called Magic Fields 2. That plugin uses custom fields, but when using front end editor to edit these custom fields, it breaks everything by editing more than one custom field. the moment I hit save using your plugin, it changed all of the custom fields on the page.

    So if users are using other plugins that use or manage custom fields, this plugin breaks it.

  4. Supplybrary
    Member
    Posted 2 years ago #

    Kahil,

    What edits did you make in Front End Editor to get it to work? I'm using Simple Fields, with some issues. Any clues would be appreciated.

  5. Kahil
    Member
    Posted 2 years ago #

    Since I'm not using the plugin I don't remember what it was I changed. Remember I just did some trial and error. Sadly, it only works in the most basic situations. If you use any advanced plugins that use things like custom fields, it doesn't work. Would love if it did. With Magic Fields 2 it messed everything up. No reason for it to since it uses custom fields.

    I also noticed that it doesn't work when you are using plugins that display content with their own php code or shortcodes. So...yeah... Need a more advanced solution.

  6. Supplybrary
    Member
    Posted 2 years ago #

    I was able to get one of the Simple Fields to show up. I went into the database under wp_postmeta and found the Simple Fields variable.

    _simple_fields_fieldGroupID_1_fieldID_2_numInSet_0

    I then added that to my Front End Editor line of code like this

    <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'textarea'); ?>

    I put that in my single.php theme file right under content like this

    <?php the_content(); ?>
    <div>
    <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'textarea'); ?>
    </div>

    that didn't fully work so I added the escape code from scribu's link like this

    <?php the_content(); ?>
    <?php function my_custom_field_escaping( $content, $post_id, $key ) {
    	if ( '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0' == $key )
    		return stripslashes( $content );
    
    	return $content;
    }
    add_filter( 'post_meta', 'my_custom_field_escaping', 10, 3 ); ?>
    <div>
    <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'textarea'); ?>
    </div>

    Now it works great.
    ...but

    How do I escape more that one Simple Fields variable?

    _simple_fields_fieldGroupID_1_fieldID_1_numInSet_0
    _simple_fields_fieldGroupID_1_fieldID_2_numInSet_0
    _simple_fields_fieldGroupID_1_fieldID_3_numInSet_0
    _simple_fields_fieldGroupID_1_fieldID_4_numInSet_0
    _simple_fields_fieldGroupID_1_fieldID_5_numInSet_0
  7. Supplybrary
    Member
    Posted 2 years ago #

    For now, I have just repeated the escape code, adding version numbers, like this.

    <?php function my_custom_field_escaping( $content, $post_id, $key ) {
    	if ( '_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0' == $key )
    		return stripslashes( $content );
    
    	return $content;
    }
    add_filter( 'post_meta', 'my_custom_field_escaping', 10, 3 ); ?>
    <?php function my_custom_field_escaping2( $content, $post_id, $key ) {
    	if ( '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0' == $key )
    		return stripslashes( $content );
    
    	return $content;
    }
    add_filter( 'post_meta', 'my_custom_field_escaping2', 10, 3 ); ?>

    etc...

    Until I hear otherwise, I'll go with that as the best solution.

    Great plugin.

  8. poco06
    Member
    Posted 1 year ago #

    Hello,
    I'm trying to edit custom fields in front end, but it's not working for me (I'm using twentyeleven theme and custompress plugin). Have you moved forward with this issue or is there anything new with the plusgin updates?
    Thanks

  9. Supplybrary
    Member
    Posted 1 year ago #

    I used code similar to this for each section needed to edit.

    <?php function my_custom_field_escaping7( $content, $post_id, $key ) {
    	if ( '_simple_fields_fieldGroupID_1_fieldID_7_numInSet_0' == $key )
    		return stripslashes( $content );
    
    	return $content;
    }
    add_filter( 'post_meta', 'my_custom_field_escaping7', 10, 3 ); ?>
    <div id="who">
    <h3>Parts</h3>
    <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_7_numInSet_0', 'textarea'); ?>
    </div>

    You will have to find the row name in the database for the section you want to edit. i found ours in wp_postmeta.

  10. poco06
    Member
    Posted 1 year ago #

    Hello and thanks for your info.
    Could you detail a little more what I have to modify in your code in order to adapt it to my own custom fields.
    Many thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic