Plugin Directory

Changeset 2671577


Ignore:
Timestamp:
02/02/2022 06:37:23 PM (4 years ago)
Author:
socialproofy
Message:

new versions

Location:
socialproofy/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • socialproofy/trunk/readme.txt

    r2515413 r2671577  
    66Requires at least: 3.1.0
    77Tested up to: 5.7.1
    8 Stable tag: 1.0.0
     8Stable tag: 1.0.2
    99License: proprietary
    1010
     
    133133== Changelog ==
    134134
    135 = 1.0.0 =
     135= 1.0.2 =
    136136Seamless, simple integration with all notification types supported, exclusive WooCommerce notification type.
    137137
  • socialproofy/trunk/socialproofy.php

    r2671569 r2671577  
    88 * Plugin Name: Social Proofy
    99 * Description: Social Proofy is a social proof marketing platform that works with your Wordpress and WooCommerce websites out of the box
    10  * Version: 1.0.1
     10 * Version: 1.0.2
    1111 * Author: Social Proofy
    1212 * Author URI: https://www.socialproofy.io/
     
    2424add_action('add_option_socialproofy_api_key', 'socialproofy_cronjob_init', 999, 0);
    2525add_action('update_option_socialproofy_api_key', 'socialproofy_cronjob_init', 999, 0);
     26
     27add_action('user_new_form', 'socialproofy_new_user', 999);
    2628
    2729add_action('woocommerce_checkout_order_processed', 'socialproofy_new_order', 999, 3);
     
    4143        socialproofy_send_customers();
    4244        update_option('socialproofy_product_offset', 0);
    43     }
    44 }
    45 
    46 function socialproofy_send_products()
    47 {
    48     $products = array();
    49 
    50     $product_count = 100;
    51 
    52     $offset = get_option('socialproofy_product_offset');
    53     if (empty($offset)) {
    54         $offset = 0;
    55         update_option('socialproofy_product_offset', $offset);
    56     }
    57 
    58     $products_query = get_posts(array(
    59         'post_type' => 'product',
    60         'numberposts' => $product_count,
    61         'offset' => $offset
    62     ));
    63 
    64     foreach ($products_query as $item) {
    65         $product_variation_lists = socialproofy_prepare_product_array($item->ID);
    66         foreach ($product_variation_lists as $element) {
    67             $products[] = $element;
    68         }
    69     }
    70 
    71     if (!empty($products)) {
    72         $post_data = array(
    73             'type' => 'all_products',
    74             'products' => $products
    75         );
    76         socialproofy_post($post_data);
    77         update_option('socialproofy_product_offset', ($offset + $product_count));
    78     }
    79 }
    80 
    81 
    82 function socialproofy_send_customers()
    83 {
    84     $customers = array();
    85     $users_query = get_users();
    86     foreach ($users_query as $key => $item) {
    87         if ($key > 30)
    88             break;
    89         $customer = socialproofy_generate_customer_data($item->ID);
    90         $customers[] = $customer;
    91     }
    92 
    93     if (!empty($customers)) {
    94         $post_data = array(
    95             'type' => 'all_customers',
    96             'customers' => $customers
    97         );
    98         socialproofy_post($post_data);
    9945    }
    10046}
     
    448394            'customer_id' => $user_id,
    449395            'nickname' => $customer_data['nickname'],
    450             'first_name' => $customer_data['first_name'],
     396            'first_name' => ucfirst($customer_data['first_name']),
    451397            'country' => $customer_data['billing_country'],
    452398            'city' => $customer_data['billing_city'],
     
    465411
    466412    socialproofy_post($post_data);
     413}
     414
     415function socialproofy_new_user($user_id)
     416{
     417    $post_data = socialproofy_generate_customer_data($user_id);
     418    $post_data['type'] = 'new_customer';
     419
     420    socialproofy_post($post_data);
     421}
     422
     423function socialproofy_send_products()
     424{
     425    $products = array();
     426
     427    $product_count = 100;
     428
     429    $offset = get_option('socialproofy_product_offset');
     430    if (empty($offset)) {
     431        $offset = 0;
     432        update_option('socialproofy_product_offset', $offset);
     433    }
     434
     435    $products_query = get_posts(array(
     436        'post_type' => 'product',
     437        'numberposts' => $product_count,
     438        'offset' => $offset
     439    ));
     440
     441    foreach ($products_query as $item) {
     442        $product_variation_lists = socialproofy_prepare_product_array($item->ID);
     443        foreach ($product_variation_lists as $element) {
     444            $products[] = $element;
     445        }
     446    }
     447
     448    if (!empty($products)) {
     449        $post_data = array(
     450            'type' => 'all_products',
     451            'products' => $products
     452        );
     453        socialproofy_post($post_data);
     454        update_option('socialproofy_product_offset', ($offset + $product_count));
     455    }
    467456}
    468457
     
    485474        'orders' => $orders,
    486475    ));
     476}
     477
     478function socialproofy_send_customers()
     479{
     480    $customers = array();
     481    $users_query = get_users();
     482    foreach ($users_query as $key => $item) {
     483        if ($key > 30)
     484            break;
     485        $customer = socialproofy_generate_customer_data($item->ID);
     486        $customers[] = $customer;
     487    }
     488
     489    if (!empty($customers)) {
     490        $post_data = array(
     491            'type' => 'all_customers',
     492            'customers' => $customers
     493        );
     494        socialproofy_post($post_data);
     495    }
    487496}
    488497
Note: See TracChangeset for help on using the changeset viewer.