Plugin Directory

Changeset 1015408


Ignore:
Timestamp:
10/28/2014 05:54:58 PM (11 years ago)
Author:
tjsantilo
Message:

Update to voting_box.php

Location:
because/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • because/trunk/README.txt

    r1012941 r1015408  
    77Tested up to: 4.0
    88<<<<<<< .mine
    9 Stable tag: 1.4.0
     9Stable tag: 1.4.1
    1010=======
    11 Stable tag: 1.4.0
     11Stable tag: 1.4.1
    1212>>>>>>> .r969865
    1313License: GPLv2 or later
  • because/trunk/admin/includes/voting_box.php

    r937351 r1015408  
    5555         */
    5656
     57        global $wpdb;
     58
    5759        // Check if our nonce is set.
    5860        if ( ! isset( $_POST['myplugin_inner_custom_box_nonce'] ) )
     
    8688        $social_polling_active_field = sanitize_text_field( $_POST['social_polling_active_field'] );
    8789        // Update the meta field.
    88         update_post_meta( $post_id, 'social_polling_active_field', $social_polling_active_field );     
     90        update_post_meta( $post_id, 'social_polling_active_field', $social_polling_active_field ); 
     91
     92        // check to see if social polling fields were already populated
     93        $old_social_polling_answer_one_field = get_post_meta( $post_id , '_social_polling_answer_one_field', true);
     94        $old_social_polling_answer_two_field = get_post_meta( $post_id , '_social_polling_answer_two_field', true);
     95        $update_table = $wpdb->prefix . "social_polling";   
    8996       
    9097                   
     
    103110        // Update the meta field.
    104111        update_post_meta( $post_id, 'social_polling_answer_one_image_id', $social_polling_answer_one_image_id );
     112
     113        if ($old_social_polling_answer_one_field){
     114            $wpdb->update( $update_table,
     115                    array(
     116                        'vote_value' => sanitize_title($social_polling_answer_one_field)
     117                    ),
     118                    array(
     119                        'poll_id' => $post_id,
     120                        'vote_value' => $old_social_polling_answer_one_field
     121                    )
     122            );
     123        }
    105124       
    106125           
     
    114133        // Update the meta field.
    115134        update_post_meta( $post_id, 'social_polling_answer_two_image_id', $social_polling_answer_two_image_id );
     135
     136        if ($old_social_polling_answer_two_field){
     137            $wpdb->update( $update_table,
     138                    array(
     139                        'vote_value' => sanitize_title($social_polling_answer_two_field)
     140                    ),
     141                    array(
     142                        'poll_id' => $post_id,
     143                        'vote_value' => $old_social_polling_answer_two_field
     144                    )
     145            );
     146        }
    116147           
    117148       
  • because/trunk/social-polling.php

    r1012941 r1015408  
    3434
    3535<<<<<<< .mine
    36  * Version:           1.4.0
     36 * Version:           1.4.1
    3737=======
    38  * Version:           1.4.0
     38 * Version:           1.4.1
    3939>>>>>>> .r969865
    4040
Note: See TracChangeset for help on using the changeset viewer.