Plugin Directory

Changeset 2426157


Ignore:
Timestamp:
11/26/2020 01:41:27 AM (5 years ago)
Author:
kylerboudreau
Message:

Follow Hook Free 2.1.0 update fixes bug where contacts could be added without an email or phone.

Location:
follow-hook/trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • follow-hook/trunk/execute_touchpoints.php

    r2167803 r2426157  
    211211    //get the person's home and work phone numbers:
    212212    $person_home_no = get_post_meta($person_id, '_pph', true);
    213     $person_work_no = get_post_meta($person_id, '_wph', true);
     213    //$person_work_no = get_post_meta($person_id, '_wph', true);
    214214    $touchpoint_id = $r->touchpoint_id;//touchpoint id
    215215    $TPtype = get_post_meta($touchpoint_id, '_interaction_type', true);
     
    347347                    $subj = "A touchpoint phone call reminder";
    348348                    $name = $user_info->user_nicename;
    349                     $msg = "Dear $name\nThis is a reminder from the Follow Hook automated system. Please note that you are supposed to make a phone call to the following person to satisfy one of your touchpoints in the Follow Hook system:\n\nName: $person_to_call\nHome Phone: $person_home_no\nWork Phone: $person_work_no";
     349                    $msg = "Dear $name\nThis is a reminder from the Follow Hook automated system. Please note that you are supposed to make a phone call to the following person to satisfy one of your touchpoints in the Follow Hook system:\n\nName: $person_to_call\nHome Phone: $person_home_no";
    350350                    Follow_Hook_log_debug("Sending email to $to User no. $assign_to(name: $name) reminding them to call $person_to_call....\n");
    351351                    wp_mail($to, $subj, $msg);
  • follow-hook/trunk/follow-hook.php

    r2408325 r2426157  
    9191        'rewrite' => array('slug' => 'people'),
    9292        //you must enter all the fields below that you want to show up as options in wp-admin/Follow Hook/forms/associate fields:
    93         'supports' => array( 'title','_firstname','_lastname', '_email','_pph','_wph','_contact_method','_addy1', 'addy2','_city','_state','_zip','_country')
     93        'supports' => array( 'title','_firstname','_lastname', '_email','_pph','_contact_method','_addy1', 'addy2','_city','_state','_zip','_country')
    9494        )
    9595    );
     
    398398
    399399$pph = get_post_meta($post->ID, '_pph', true);
    400 $wph = get_post_meta($post->ID, '_wph', true);
     400//$wph = get_post_meta($post->ID, '_wph', true);
    401401$contact_method = get_post_meta($post->ID, '_contact_method', true);//array of checked values!
    402402
     
    465465
    466466  <div class="follow-hook-clear"></div>
    467   <div class="follow-hook-field">Email: <input type="text" name="_email" value="<?php echo $email; ?>" class="follow-hook-field" /></div>
    468   <div class="follow-hook-field">Mobile Phone: <input type="text" name="_pph" value="<?php echo $pph; ?>" class="follow-hook-field" /></div>
     467  <div class="follow-hook-field">Email: <input type="text" id="_email" name="_email" value="<?php echo $email; ?>" class="follow-hook-field" /></div>
     468  <div class="follow-hook-field">Phone: <input type="text" id="_pph" name="_pph" value="<?php echo $pph; ?>" class="follow-hook-field" /></div>
    469469
    470470  <div class="follow-hook-clear"></div>
    471   <div class="follow-hook-field">Work Phone: <input type="text" name="_wph" value="<?php echo $wph; ?>" class="follow-hook-field" /></div>
     471  <?php /*?><div class="follow-hook-field">Work Phone: <input type="text" name="_wph" value="<?php echo $wph; ?>" class="follow-hook-field" /></div><?php */?>
    472472
    473473  <div class="follow-hook-clear-pad"></div>
     
    749749    update_post_meta($post_id, '_email', $_POST['_email']);
    750750    update_post_meta($post_id, '_pph', sanitize_text_field($_POST['_pph']));
    751     update_post_meta($post_id, '_wph', sanitize_text_field($_POST['_wph']));
     751    //update_post_meta($post_id, '_wph', sanitize_text_field($_POST['_wph']));
    752752    update_post_meta($post_id, '_contact_method', sanitize_text_field($_POST['_contact_method']));
    753753    update_post_meta($post_id, '_todo', sanitize_text_field($_POST['_todo']));
     
    18831883
    18841884
     1885add_action( 'wp_ajax_fh_check_for_email_and_phone', 'fh_check_for_email_and_phone' );
     1886
     1887function fh_check_for_email_and_phone(){
     1888   
     1889    if( is_admin() ){       
     1890       
     1891          global $wpdb;
     1892         
     1893          $return_arr[ 'email_exists' ] = 0;
     1894          $return_arr[ 'pph_exists' ] = 0;
     1895         
     1896          if( !empty( $_POST['_email'] )  ){
     1897         
     1898              $email_exists = $wpdb->get_col($wpdb->prepare(
     1899                "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_email' AND meta_value = %s AND post_id != %d",
     1900                 $_POST['_email'],$_POST['post_ID']
     1901              ));
     1902         
     1903         
     1904             if( $email_exists )
     1905                 $return_arr[ 'email_exists' ] = $email_exists[0];
     1906                 
     1907          }
     1908         
     1909          if( !empty( $_POST['_pph'] )  ){
     1910             
     1911              $pph_exists = $wpdb->get_col($wpdb->prepare(
     1912                "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_pph' AND meta_value = %s AND post_id != %d",
     1913                 $_POST['_pph'],$_POST['post_ID']
     1914              ));
     1915             
     1916              if( $pph_exists )
     1917                 $return_arr[ 'pph_exists' ] = $pph_exists[0]; 
     1918                 
     1919         }
     1920         
     1921         echo json_encode($return_arr);   
     1922 
     1923 
     1924        die;
     1925    }
     1926}
     1927
     1928
    18851929
    18861930//added code to make the email field for People CPT unique:
  • follow-hook/trunk/js/auto_fill_people_title.js

    r2135129 r2426157  
    66    document.getElementById('title').value = t;
    77}//end auto_fill_people_title JS function by Ian L. of jafty.com
     8
     9
     10jQuery(document).ready(function($){
     11    $('#publish').click(function(){
     12       
     13       
     14        post_type = $('#post_type').val();
     15       
     16        post_ID = $('#post_ID').val();
     17       
     18        if( post_type == 'people' ){
     19           
     20            _email  = $('#_email').val();
     21            _pph    = $('#_pph').val();
     22           
     23            if( _email == '' && _pph == '' ){
     24               
     25                alert('Please enter email or phone');
     26                return false;
     27               
     28            }
     29            else{
     30               
     31                $('<span id="fhwait">Please wait while we are validating...</span>' ).insertBefore( $(this) );
     32               
     33                var data = {
     34                    action: 'fh_check_for_email_and_phone',
     35                    _email: _email,
     36                    _pph: _pph,
     37                    post_ID: post_ID
     38                   
     39                }; 
     40               
     41                jQuery.post(ajaxurl, data, function(response) {
     42                                                   
     43                    $('#fhwait').remove();                             
     44                   
     45                    if( response.email_exists == 0 && response.pph_exists == 0 ){                       
     46                        $('#post').submit();
     47                    }
     48                   
     49                    if( response.email_exists > 0  || response.pph_exists > 0 ){
     50                   
     51                        alert('Oops! The email or phone you have entered belongs to another person, please use another.');
     52                        return false;
     53                    }
     54                   
     55                }, "json");
     56               
     57                return false;
     58                   
     59            }
     60            $('#post').submit();
     61        }
     62       
     63    });                             
     64});
  • follow-hook/trunk/readme.txt

    r2408325 r2426157  
    77Author URI: https://followhook.com/
    88Author:  Kyler Boudreau and Ian Lincicome of Follow Hook
    9 Requires at least: 5.5.0
    10 Tested up to: 5.5.1
     9Requires at least: 5.1.0
     10Tested up to: 5.5.3
    1111Stable tag: trunk
    12 Version:   1.2.2
     12Version:   2.1.0
    1313Requires PHP: 7.1
    1414License URI: https://followhook.com/downloads/follow-hook/
  • follow-hook/trunk/time.txt

    r2408325 r2426157  
    1 2020-10-28 13:41:17
     12020-11-26 00:00:20
Note: See TracChangeset for help on using the changeset viewer.