• Resolved martcol

    (@hotmale)


    I have been given a couple of lines of code that removes data after a form submission (Gravity forms). I know this is not a WordPress repository plugin but I have tried to make it in to a plugin for my own use.

    I put the coded into the plugin template which registers OK on my site but it issues this warning

    The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    This is my code.

    <?php
    		/*
    		Plugin Name: Martin Remove GF Data
    		Plugin URI: https://www.martcol.co.uk
    		Description: Plugin for date collected from GF form submissions
    		Author: Gravity Forms
    		Version: 1.0
    		Author URI: https://www.marcol.co.uk
    		*/
    	?>
    
    <?php
    //delete entry after form 30 has been submitted
    add_action( 'gform_after_submission', 'remove_form_entry', 10, 2 );
    function remove_form_entry( $entry, $form ) {
        // delete the entry using the API introduced in v1.8
        GFAPI::delete_entry( $entry['id'] );
    }
    ?>

    Is it difficult to fix?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try tightening-up your code and removing white space.

    <?php
    /*
    Plugin Name: Martin Remove GF Data
    Plugin URI: https://www.martcol.co.uk
    Description: Plugin for date collected from GF form submissions
    Author: Gravity Forms
    Version: 1.0
    Author URI: https://www.marcol.co.uk
    */
    ?>
    <?php
    //delete entry after form 30 has been submitted
    add_action( 'gform_after_submission', 'remove_form_entry', 10, 2 );
    function remove_form_entry( $entry, $form ) {
    // delete the entry using the API introduced in v1.8
    GFAPI::delete_entry( $entry['id'] );
    }
    ?>

    That activates without any errors for me.

    Thread Starter martcol

    (@hotmale)

    Ba Boom!

    That fixed it and I am very, very grateful.

    Learned a valuable lesson too.

    Thanks

    Martin

    You’re welcome!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘plugin generated 1 characters of unexpected output’ is closed to new replies.