Support » Plugin: PHP Code for posts » Notice in snippet.php

  • error.log:

    [22-Nov-2016 21:27:52 UTC] PHP Notice: Undefined index: shared in /***/public_html/wp-content/plugins/php-code-for-posts/Classes/Snippet.php on line 166

    line code:

    		$snippet->set_shared( intval($post_fields['shared']) );
    

    code block:

    	public static function save_posted_snippet( $post_fields )
    	{
    		$snippet_id = isset( $post_fields['item'] ) ? $post_fields['item'] : 0;
    		$snippet = $snippet_id > 0 ? PhpCodeForPosts_Database::load_single_snippet( $snippet_id ) : new PhpCodeForPosts_Snippet();
    
    		$snippet->set_name( stripslashes($post_fields['name']) );
    		$snippet->set_code( $post_fields['code'] );
    		$snippet->set_description( stripcslashes($post_fields['description']) );
    		$snippet->set_shared( intval($post_fields['shared']) );
    
    		PhpCodeForPosts_Snippet::$last_saved_snippet = $snippet;
    
    		return PhpCodeForPosts_Database::save_snippet( $snippet );
    	}

    regards…

  • The topic ‘Notice in snippet.php’ is closed to new replies.