Plugin Directory

Changeset 454094


Ignore:
Timestamp:
10/22/2011 01:57:08 AM (14 years ago)
Author:
SimonaIlie
Message:

version 1.4: fix activation warning bug; added bulk delete option

Location:
comment-extra-field
Files:
41 added
6 edited

Legend:

Unmodified
Added
Removed
  • comment-extra-field/trunk/comment-extra-fields-config.php

    r446799 r454094  
    3131if(!defined('CEF_POSTFIX_DB_VALUE_COL')) define('CEF_POSTFIX_DB_VALUE_COL', '_col_value');
    3232if(!defined('CEF_POSTFIX_HTML_CODE')) define('CEF_POSTFIX_HTML_CODE', '_html_code');
     33if(!defined('CEF_POSTFIX_LOCATION')) define('CEF_POSTFIX_LOCATION', '_location');
    3334
    3435if(!defined('CEF_OPTION_SEPARATOR')) define('CEF_OPTION_SEPARATOR', ';');
     
    4647
    4748if(!defined('CEF_ADMIN_URL')) define('CEF_ADMIN_URL', get_bloginfo('siteurl') . '/wp-admin/options-general.php?page=comment-extra-fields');
     49
     50if(!defined('CEF_LOCATION_BOTH')) define('CEF_LOCATION_BOTH', 100);
     51if(!defined('CEF_LOCATION_GUEST')) define('CEF_LOCATION_GUEST', 101);
     52if(!defined('CEF_LOCATION_LOGGED')) define('CEF_LOCATION_LOGGED', 102);
    4853?>
  • comment-extra-field/trunk/comment-extra-fields-functions.php

    r446058 r454094  
    479479
    480480    global $wpdb;
    481     $sql    = "SELECT option_name FROM {$wpdb->options} WHERE option_value='" . esc_attr($cef_id) . "' AND option_name LIKE ('" . CEF_OPTION_PREFIX . CEF_POSTFIX_ID . "%')";
     481    $sql    = "SELECT option_name FROM {$wpdb->options} WHERE option_value='" . $cef_id . "' AND option_name LIKE ('" . CEF_OPTION_PREFIX . CEF_POSTFIX_ID . "%')";
    482482    $data   = $wpdb->get_var($sql);
    483483    return ($data) ? str_replace(CEF_OPTION_PREFIX . CEF_POSTFIX_ID, '', $data) : '';
  • comment-extra-field/trunk/comment-extra-fields.php

    r446799 r454094  
    22/*
    33Plugin Name: Comment Extra Fields
    4 Plugin URI: http://elfdreamer.blogspot.com/2011/09/wordpress-comment-extra-fields-plugin.html
     4Plugin URI: http://wordpress.org/extend/plugins/comment-extra-field/
    55Description: Allows administrator to add custom fields to comment form. On admin side let you update/delete the extra info.
    6 Version: 1.3
     6Version: 1.4
    77Author: Simona Ilie
    8 Author URI: http://elfdreamer.blogspot.com
     8Author URI:
    99License: GPL2
    1010
     
    5050    wp_enqueue_style('comment-extra-fields-tooltips', CEF_FULL_PLUGIN_PATH . 'css/jquery.tooltip.css');
    5151    wp_enqueue_style('comment-extra-fields-style', CEF_FULL_PLUGIN_PATH . 'css/style.css');
    52     ?>
    53 <script type="text/javascript">
    54      var cef_admin_url   = "<?php echo CEF_ADMIN_URL;?>";
    55 </script>
    56 <?php else:
     52else:
    5753    wp_enqueue_script('jquery-on-front', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js', null, null, null);
    5854    wp_enqueue_script('swf-uploader', CEF_FULL_PLUGIN_PATH . 'scripts/swfupload.js', null, null, null);
     
    6056    wp_enqueue_script('cef-script-uploader', CEF_FULL_PLUGIN_PATH . 'scripts/cef.uploader.js', null, null, null);
    6157    wp_enqueue_style('custom_style', CEF_FULL_PLUGIN_PATH . 'css/front/cef-style.css', null, null);
    62     ?>
     58if(!isset($_POST['action'])) :
     59?>
     60
    6361<script type="text/javascript">
    6462    var plugin_url = "<?php echo CEF_FULL_PLUGIN_PATH;?>";
    6563</script>
    6664<?php endif;
     65endif;
    6766/**
    6867 * include a submenu option under Settings Dashboard
     
    105104?>
    106105<script type='text/javascript'>
    107     var cef_plugin_url      = '<?php echo CEF_FULL_PLUGIN_PATH;?>';
     106    var cef_admin_url      = '<?php echo CEF_ADMIN_URL;?>';
     107    var cef_plugin_url     = '<?php echo CEF_FULL_PLUGIN_PATH;?>';
    108108    var cef_input_types    = <?php echo json_encode(array(CEF_INPUT_TEXT, CEF_INPUT_TEXTAREA, CEF_INPUT_CHECKBOX, CEF_INPUT_RADIO, CEF_INPUT_SELECT, CEF_INPUT_FILE, CEF_INPUT_DB_SELECT));?>;
    109109</script>
     
    115115        <thead>
    116116            <tr>
    117             <!--    <th style="" class="manage-column column-cb check-column" id="cb" scope="col">
     117               <th style="" class="manage-column column-cb check-column" id="cb" scope="col">
    118118                    <input type="checkbox">
    119                 </th> -->
     119                </th>
    120120                <th style="" class="manage-column column-title sortable desc" id="cef_field_name_row" scope="col">
    121121                    <span><a><?php _e('Field Name');?></a></span>
     
    134134        <tfoot>
    135135            <tr>
    136              <!--   <th style="" class="manage-column column-cb check-column" scope="col">
     136                <th style="" class="manage-column column-cb check-column" scope="col">
    137137                    <input type="checkbox">
    138                 </th> -->
     138                </th>
    139139                <th style="" class="manage-column column-title sortable desc" scope="col">
    140140                    <span><a><?php _e('Field Name');?></a></span>
     
    155155                foreach($comment_extra_fields as $cef):?>
    156156            <tr valign="top" class="alternate author-self status-publish format-default iedit" id="post-9">
    157                <!-- <th class="check-column" scope="row"><input type="checkbox" value="<?php echo $cef['id'];?>" name="cef[]"></th> -->
     157                <th class="check-column" scope="row"><input type="checkbox" value="<?php echo $cef['id'];?>" name="cef[]"></th>
    158158                <td class="post-title page-title column-title"><?php echo $cef['label'];?></td>
    159159                <td><?php echo ucwords($cef['type']);?></td>   
     
    169169        </tbody>
    170170    </table>
     171    <div class="cef-horizonat-space"><!-- --></div>
     172    <input type="button" class="cef-btn" id="delete-selected-cefs" value="Delete Selected Fields" />
    171173    <div class="cef-horizontal-line"><!-- --></div>
    172174    <h3><?php _e('Add/Edit Field');?></h3>
     
    341343                </td>
    342344            </tr>
    343             <!-- <tr>
    344                 <td colspan="2">
    345                     <input type="checkbox" id="cef_field_required" name="cef_field_required" />
    346                     <label for="cef_field_required"><?php _e('Field is required');?></label>
    347                 </td>
    348             </tr> -->
     345          <!--  <tr>
     346                <td>
     347                    <label for="cef_field_location"><?php _e('Field Location');?></label>
     348                </td>
     349                <td colspan="3">
     350                    <input type="radio" name="cef_field_location" id="cef_field_location_both" value="<?php echo CEF_LOCATION_BOTH;?>" />
     351                    <label for="cef_field_location_both"><?php _e('Both');?></label>
     352                    <input type="radio" name="cef_field_location" id="cef_field_location_guest" value="<?php echo CEF_LOCATION_GUEST;?>" />
     353                    <label for="cef_field_location_guest"><?php _e('Only Guests');?></label>
     354                    <input type="radio" name="cef_field_location" id="cef_field_location_logged" value="<?php echo CEF_LOCATION_LOGGED;?>" />
     355                    <label for="cef_field_location_logged"><?php _e('Only Logged in user');?></label>
     356                </td>
     357          </tr> -->
    349358            <tr>
    350359                <td>&nbsp;</td>
  • comment-extra-field/trunk/css/style.css

    r446058 r454094  
    200200    color: #000000;
    201201}
     202
     203.cef-horizonat-space
     204{
     205    padding-top: 10px;
     206}
     207
     208.cef-btn
     209{
     210    cursor:pointer;
     211}
  • comment-extra-field/trunk/js/scripts.js

    r446058 r454094  
    3535      else if(hints_div.hasClass('cef-show'))
    3636          my_toggle_class(hints_div, 'cef-show', 'cef-hide');
     37   });
     38   $('#delete-selected-cefs').click(function(){
     39        var selected_ids = new Array();
     40        $("input[name='cef[]']:checked").each(function(){
     41            selected_ids.push($(this).val());
     42        });
     43        if(selected_ids.length == 0) {
     44            alert('No fields selected.')
     45        } else {
     46            $.ajax({
     47                url:cef_plugin_url + 'cef-ajax.php',
     48                data: {cef: selected_ids, action:'delete-bulk'},
     49                dataType: 'JSON',
     50                type:'POST',
     51                success: function(response)
     52                {
     53                    $('input[name="cef[]"]').removeAttr('checked');
     54                    window.location.reload();
     55                },
     56                error: function()
     57                {
     58                    alert('There was an error. The fields could not be deleted.');
     59                }
     60            })
     61        }
    3762   });
    3863});
  • comment-extra-field/trunk/readme.txt

    r446799 r454094  
    55Requires at least: 3.2.1
    66Tested up to: 3.2.1
    7 Stable tag: 1.3
     7Stable tag: 1.4
    88
    99Add extra fields to default Wordpress comment form
     
    1919
    2020To use the users input for extra fields in your theme there are two functions:
    21 
     21 
    2222cef_get_all_extra_field_values($comment_id);
    2323
     
    6767= 1.3 =
    6868
    69 * fix plugin path bug
     69* fix base plugin path bug
     70
     71= 1.4 =
     72
     73* fix "unexpected output" warning during activation
     74
     75* added bulk fields deletion option
    7076
    7177== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.