WordPress.org

Ready to get started?Download WordPress

Forums

Code Snippets
Carriage returns being replaced by "rn" on save (8 posts)

  1. norrismp
    Member
    Posted 11 months ago #

    For example if I enter:

    function user_role_update( $user_id, $new_role ) {
    	echo 'hello world';
    }
    add_action( 'set_user_role', 'user_role_update', 10, 2);

    then on 'save' it becomes:

    function user_role_update( $user_id, $new_role ) {rn    echo 'hello world';rn     }rnadd_action( 'set_user_role', 'user_role_update', 10, 2);

    and it's breaking my site/snippets. This occurred after the latest wordpress update and code snippet update (I'm running latest versions of both). I tried deactivating other plugins but it doesn't help.

    Help!

    http://wordpress.org/plugins/code-snippets/

  2. norrismp
    Member
    Posted 11 months ago #

    Update (not solved): it appears the bigger problem is that none of my changes are being saved. On the latest round of wordpress updates all of my code snippet carriage returns were turned into "rn" (no other posts were affected). When I try and correct this and click save it is just not saving the changes and then returning the old version.

    I turned off my cacheing plugin (w3 total) and that had no effect. Any ideas?

  3. Shea Bunge
    Member
    Plugin Author

    Posted 11 months ago #

    That's really strange. On my test sites, I can successfully add a new snippet, and edit an existing snippet with no problems at all. I wonder what the problem could be?

  4. Shea Bunge
    Member
    Plugin Author

    Posted 11 months ago #

    Have you tried looking at the raw snippet code in the database table? What do the snippets look like there?

  5. norrismp
    Member
    Posted 11 months ago #

    It is very strange. For some of my snippets I had to create and save a new snippet, for others I was able to save it once, but then subsequent saves didn't work. I haven't dug into your code to see what sort of validation occurs but updated=1 in the query string so it seems to be passing whatever tests it is undergoing.

    Any ideas on where to start looking would be appreciated.

  6. norrismp
    Member
    Posted 11 months ago #

    I'm going to sleep now but will check out the database tomorrow. Where are the snippets stored?

    I haven't noticed a pattern to whether or not a save is successful. I changed one long snippet to a simple echo snippet and it saved just fine. Then I tried changing the text of the echo statement (from 'test' to 'dfdfd') and that wouldn't save.

    Thanks for your help.

  7. Shea Bunge
    Member
    Plugin Author

    Posted 11 months ago #

    The snippets are stored in the wp_snippets table (wp_ will be whatever your DB prefix is set to). I'll have a look to see if there is something in the plugin code causing the problem.

  8. Shea Bunge
    Member
    Plugin Author

    Posted 8 months ago #

    Can I check if this issue was resolved in 1.9?

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.