WordPress.org

Plugin Directory

Changeset 1503619


Ignore:
Timestamp:
09/27/16 12:59:16 (11 months ago)
Author:
pgogy
Message:

Bug fix on inline save_post
With thanks to Peter Matthews

Location:
anonymous-comments
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • anonymous-comments/trunk/code/config/class-anonymous_comments_config.php

    r1449875 r1503619  
    1818        $admin_checked = get_post_meta($post->ID, "admin_bypass_anonymous_comments", true); 
    1919        ?><p><label><?PHP echo __("Enable anonymous comments"); ?></label> 
    20         <input type="checkbox" name="anonymous_comments" <?PHP if($checked!=""){ echo " checked "; } ?> /></p> 
     20        <input type="checkbox" value="on" name="anonymous_comments" <?PHP if($checked!=""){ echo " checked "; } ?> /></p> 
    2121        <p><label><?PHP echo __("Show author name in comments"); ?></label> 
    22         <input type="checkbox" name="show_author_anonymous_comments" <?PHP if($author_checked!=""){ echo " checked "; } ?> /></p> 
     22        <input type="checkbox" value="on" name="show_author_anonymous_comments" <?PHP if($author_checked!=""){ echo " checked "; } ?> /></p> 
    2323        <p><label><?PHP echo __("Allow admin to bypass anonymity"); ?></label> 
    24         <input type="checkbox" name="admin_bypass_anonymous_comments" <?PHP if($admin_checked!=""){ echo " checked "; } ?> /></p> 
     24        <input type="checkbox" value="on" name="admin_bypass_anonymous_comments" <?PHP if($admin_checked!=""){ echo " checked "; } ?> /></p> 
    2525        <?PHP 
    2626    } 
    2727     
    2828    function save_post($post_id){ 
    29         if(isset($_POST['anonymous_comments'])){ 
    30             if($_POST['anonymous_comments']=="on"){ 
    31                 update_post_meta($post_id, "anonymous_comments", "on"); 
     29     
     30        if(isset($_POST['action'])){ 
     31            if($_POST['action']=="editpost"){ 
     32                if(isset($_POST['anonymous_comments'])){ 
     33                    if($_POST['anonymous_comments']=="on"){ 
     34                        update_post_meta($post_id, "anonymous_comments", "on"); 
     35                    } 
     36                }else{ 
     37                    delete_post_meta($post_id, "anonymous_comments"); 
     38                } 
     39                if(isset($_POST['show_author_anonymous_comments'])){ 
     40                    if($_POST['show_author_anonymous_comments']=="on"){ 
     41                        update_post_meta($post_id, "anonymous_comments", "on"); 
     42                        update_post_meta($post_id, "show_author_anonymous_comments", "on"); 
     43                    } 
     44                }else{ 
     45                    delete_post_meta($post_id, "show_author_anonymous_comments"); 
     46                } 
     47                if(isset($_POST['admin_bypass_anonymous_comments'])){ 
     48                    if($_POST['admin_bypass_anonymous_comments']=="on"){ 
     49                        update_post_meta($post_id, "admin_bypass_anonymous_comments", "on"); 
     50                        update_post_meta($post_id, "anonymous_comments", "on"); 
     51                    } 
     52                }else{ 
     53                    delete_post_meta($post_id, "admin_bypass_anonymous_comments"); 
     54                } 
    3255            } 
    33         }else{ 
    34             delete_post_meta($post_id, "anonymous_comments"); 
    35         } 
    36         if(isset($_POST['show_author_anonymous_comments'])){ 
    37             if($_POST['show_author_anonymous_comments']=="on"){ 
    38                 update_post_meta($post_id, "anonymous_comments", "on"); 
    39                 update_post_meta($post_id, "show_author_anonymous_comments", "on"); 
    40             } 
    41         }else{ 
    42             delete_post_meta($post_id, "show_author_anonymous_comments"); 
    43         } 
    44         if(isset($_POST['admin_bypass_anonymous_comments'])){ 
    45             if($_POST['admin_bypass_anonymous_comments']=="on"){ 
    46                 update_post_meta($post_id, "admin_bypass_anonymous_comments", "on"); 
    47                 update_post_meta($post_id, "anonymous_comments", "on"); 
    48             } 
    49         }else{ 
    50             delete_post_meta($post_id, "admin_bypass_anonymous_comments"); 
    5156        } 
    5257    } 
  • anonymous-comments/trunk/readme.txt

    r1493137 r1503619  
    44Requires at least: 3.0.1 
    55Tested up to: 4.6 
    6 Stable tag: 0.3 
     6Stable tag: 0.4 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
Note: See TracChangeset for help on using the changeset viewer.