WordPress.org

Ready to get started?Download WordPress

Forums

User inputted Iframe adding '\" (1 post)

  1. mlotorocks
    Member
    Posted 10 months ago #

    So I know what the problem is I just can't find the solution.

    I have a text field that I need a user to input their bandcamp embed iframe and then display on a page.

    I have it almost there but in firebug I can see that in the code for the iframe it looks like it's escaping. I've tried a few things but always get something like this in firebug:
    <iframe seamless="" src="\"http://bandcamp.com/EmbeddedPlayer.....

    This is my text field:
    <input id="bandcamp-id" type="text" name="bandcamp-id" value="<?php echo custom_field('bandcamp-id'); ?>" />

    and here's the rest:

    function group_header_fields_save( $group_id ) {
    global $bp, $wpdb;
    $plain_fields = array(
    'genre',
    'bandcamp-id'
    );
    foreach( $plain_fields as $field ) {
    $key = $field;
    if ( isset( $_POST[$key] ) ) {
    $value = $_POST[$key];
    groups_update_groupmeta( $group_id, $field, $value );
    }
    }
    }
    add_filter( 'groups_custom_group_fields_editable', 'group_header_fields_markup' );
    add_action( 'groups_group_details_edited', 'group_header_fields_save' );
    add_action( 'groups_created_group',  'group_header_fields_save' );
    
    // Show the custom field in the group header
    function show_field_in_header( ) {
    echo "<p> <strong>Musical Genre: </strong>" . custom_field('genre') . "</p>";
    
    echo "<p>" . custom_field('bandcamp-id') . "</p>";
    echo do_shortcode('[gallery]');
    }
    add_action('bp_group_header_meta' , 'show_field_in_header') ;
    }
    add_action( 'bp_include', 'bp_group_meta_init' );

Reply

You must log in to post.

About this Topic