Plugin Directory

Changeset 2263980


Ignore:
Timestamp:
03/19/2020 03:43:40 PM (6 years ago)
Author:
orangetoolz
Message:

*Choose users mail form specefic form

Location:
cf7-db-tool/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cf7-db-tool/trunk/assets/js/cf7-db-bulkmail.js

    r2261940 r2263980  
    66            cf7form : 0,
    77        }
    8         // $('#select-department_list').on('change', function() {
    9         //  OBJ.department = $(this).find(":selected").val() ;
    10         //  callFromDB();
    11         // });
    128
    139        $('#select-session_list').on('change', function() {
    1410            OBJ.cf7form = $(this).find(":selected").val() ;
     11            alert(OBJ.cf7form)
    1512            callFromDB();
    1613        });
    1714        function callFromDB() {
    1815            if(OBJ.cf7form != 0 ){
     16
    1917                $.post(ajax_object.ajax_url,{
    2018                    'action':'bulkMailAjaxDataAction',
    21                     'department': OBJ.cf7form,
     19                    'cf7form': OBJ.cf7form,
    2220                },function(data){
    2321                    if(data == 0){
    2422                        alert('No Data Found');
    2523                    }else{
    26                         //console.log(data);
    2724                        $('#dbtool-user-list').html(data);
    2825                    }
  • cf7-db-tool/trunk/cf7-db-tool.php

    r2261940 r2263980  
    88 * Text Domain: cf7-db-tool
    99 * Tags: contact, cf7, contact form 7, db, export, save, wpcf7, contact form 7 db,  contact form 7 database, contact form 7 data export, contact form 7 database addon
    10  * Version: 3.0.1
     10 * Version: 3.1.1
    1111 */
    1212
  • cf7-db-tool/trunk/readme.txt

    r2261940 r2263980  
    44Requires at least: 4.8
    55Tested up to: 5.3
    6 Stable tag: 3.0.1
     6Stable tag: 3.1.1
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3131Upcoming features:
    3232
    33 * Choose bulk mail contacts from cf7 forms
    3433* Email integration with bulk mail
    3534
     
    9897= 3.0.1 =
    9998*Release Date - March 16, 2020*
    100 *Bulk email validation complete, design changed & Reset button issue fixed
     99*Bulk email validation complete, design updated & Reset button issue fixed
    101100
     101= 3.1.1 =
     102*Release Date - March 19, 2020*
     103*Choose users mail form specefic form
     104
  • cf7-db-tool/trunk/src/BulkMail.php

    r2261940 r2263980  
    1111
    1212        $this->cf7DBBulkMail();
    13         add_action('wp_ajax_bulkMailAjaxDataAction',[$this,'bulkMailAjaxDataAction']);
     13        add_action('wp_ajax_nopriv_bulkMailAjaxDataAction', array( $this, 'bulkMailAjaxDataAction' ));
     14        add_action('wp_ajax_bulkMailAjaxDataAction', array( $this, 'bulkMailAjaxDataAction' ));
    1415
    1516    }
     
    174175                                                        </div>
    175176
    176 <!--                                                        <div class="select-department">-->
    177 <!--                                                            <select  id="select-department_list">-->
    178 <!--                                                                <option value="">-- --><?php //_e( 'Select Department', 'dumhall' ); ?><!-- --</option>-->
    179 <!--                                                                --><?php
    180 //
    181 //                                                                $users = get_users( array( 'fields' => array( 'ID' ) ) );
    182 //                                                                foreach($users as $user_id){
    183 //                                                                    $data = get_user_meta ( $user_id->ID);
    184 //                                                                    if(!empty($data['department'][0])){
    185 //                                                                        echo '<option value="' . esc_html( $data['department'][0]) . '">' . esc_html( $data['department'][0] ) . '</option>';
    186 //                                                                    }
    187 //                                                                }
    188 //                                                                ?>
    189 <!--                                                            </select>-->
    190 <!--                                                        </div>-->
    191 <!--                                                        <div class="select-session">-->
    192 <!--                                                            <select   id="select-session_list">-->
    193 <!--                                                                <option value="">-- --><?php //_e( 'Select Form', 'dumhall' ); ?><!-- --</option>-->
    194 <!--                                                                <option value="1">hell</option>-->
    195 <!--                                                                <option value="2">hell2</option>-->
    196 <!--                                                                <option value="3">hell3</option>-->
    197 <!--                                                                <option value="4">hell4</option>-->
    198 <!--                                                                --><?php
    199 //
    200 //
    201 //                                                                ?><!-- $users = get_users( array( 'fields' => array( 'ID' ) ) );-->
    202 <!--                                                                foreach($users as $user_id){-->
    203 <!--                                                                $data = get_user_meta ( $user_id->ID);-->
    204 <!--                                                                if(isset($data['session'][0])){-->
    205 <!--                                                                echo '<option value="' . esc_html( $data['session'][0]) . '">' . esc_html( $data['session'][0] ) . '</option>';-->
    206 <!--                                                                }-->
    207 <!--                                                                }-->
    208 <!--                                                            </select>-->
    209 <!--                                                        </div>-->
     177
     178                                                        <div class="select-session">
     179                                                            <select   id="select-session_list">
     180                                                                <option value="">-- <?php _e( 'Select Form', 'dumhall' ); ?> --</option>
     181                                                        <?php
     182
     183                                                        $allForms = $this->get_prepare_forms_list();
     184                                                        foreach ($allForms as $form){
     185                                                           echo ' <option value="'.$form->form_id.'">'.$form->title.'</option>';
     186                                                       }
     187
     188
     189                                                        ?>
     190                                                            </select>
     191
     192
     193                                                        </div>
    210194
    211195                                                        <div class="reset-entery-data">
     
    278262
    279263    // Ajax request for load targeted form users
    280     public function bulkMailAjaxDataAction(){
    281       echo "<script>alert('hello');</script>";
    282 
    283 //        // this is required to terminate immediately and return a proper response
    284 //        $department = '';
    285 //        $session = '';
    286 //        if(isset($_POST['department'])){
    287 //            $department = sanitize_text_field($_POST['department']);
    288 //        }
     264    public function bulkMailAjaxDataActionss(){
     265
     266
     267// this is required to terminate immediately and return a proper response
     268        echo "test";
     269        $cf7form = '';
     270        if(isset($_POST['cf7form'])){
     271            $cf7form = sanitize_text_field($_POST['cf7form']);
     272        }
    289273//        if(isset($_POST['session'])){
    290274//            $session = sanitize_text_field($_POST['session']);
     
    306290//        );
    307291//        $users = get_users( $args );
    308 //
     292
    309293//        foreach ( $users as $user ) {
    310294//            //var_dump($user->user_email);
     
    318302//
    319303//        };
     304        echo '<option value="maruf@gmail.com">'.$cf7form.'</option>';
    320305        wp_die();
    321306    }
  • cf7-db-tool/trunk/src/ListEntries.php

    r2245565 r2263980  
    7373    }
    7474
    75 
     75// get form list from database
     76    public function get_prepare_forms_list()
     77    {
     78        global $wpdb;
     79        $result = $wpdb->get_results("SELECT * FROM " .$wpdb->prefix. "cf7_dbt_forms");
     80        return $result;
     81    }
     82
     83// get mail list from database
    7684    public function get_prepare_mail_items()
    7785    {
    7886        global $wpdb;
    7987        $result = $wpdb->get_results("SELECT fields FROM " .$wpdb->prefix. "cf7_dbt_entries");
    80         //var_dump($result);
    81 
    8288        return $result;
    83 
    84 
    8589    }
     90
     91    // get mail list from specific form
     92    public function get_prepare_mail_items_from_target_form()
     93    {
     94        global $wpdb;
     95        $results = $wpdb->get_results("SELECT fields FROM " .$wpdb->prefix. "cf7_dbt_entries where form_id=6"  );
     96        return $results;
     97    }
     98
    8699
    87100
  • cf7-db-tool/trunk/src/Plugin.php

    r2245565 r2263980  
    6060        $this->report = new Report($this->config);
    6161        $this->formEntries = new FormEntries($this->config);
    62 
    63     }
     62        add_action('wp_ajax_bulkMailAjaxDataAction', [$this,'bulkMailAjaxDataAction']);
     63
     64    }
     65
    6466
    6567    /**
     
    215217        return ob_get_flush();
    216218    }
     219
     220
     221    /**
     222     * Load users mail from target form
     223     */
     224    public function bulkMailAjaxDataAction(){
     225
     226        $cf7form = '';
     227        if(isset($_POST['cf7form'])){
     228            $cf7form = sanitize_text_field($_POST['cf7form']);
     229        }
     230        global $wpdb;
     231        $results = $wpdb->get_results("SELECT fields FROM " .$wpdb->prefix. "cf7_dbt_entries where form_id=" .$cf7form );
     232        $usersEmail=[];
     233        foreach ($results as $mail){
     234            $fields = unserialize($mail->fields);
     235
     236            if(!in_array($fields["your-email"],$usersEmail)){
     237                array_push($usersEmail,$fields["your-email"]);
     238            }
     239
     240        }
     241        foreach ($usersEmail as $email){
     242            echo '<option value='.$email.'>'.$email.'</option>';
     243        }
     244
     245        wp_die();
     246    }
    217247}
    218248
Note: See TracChangeset for help on using the changeset viewer.