Changeset 2671577
- Timestamp:
- 02/02/2022 06:37:23 PM (4 years ago)
- Location:
- socialproofy/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
socialproofy.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
socialproofy/trunk/readme.txt
r2515413 r2671577 6 6 Requires at least: 3.1.0 7 7 Tested up to: 5.7.1 8 Stable tag: 1.0. 08 Stable tag: 1.0.2 9 9 License: proprietary 10 10 … … 133 133 == Changelog == 134 134 135 = 1.0. 0=135 = 1.0.2 = 136 136 Seamless, simple integration with all notification types supported, exclusive WooCommerce notification type. 137 137 -
socialproofy/trunk/socialproofy.php
r2671569 r2671577 8 8 * Plugin Name: Social Proofy 9 9 * 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. 110 * Version: 1.0.2 11 11 * Author: Social Proofy 12 12 * Author URI: https://www.socialproofy.io/ … … 24 24 add_action('add_option_socialproofy_api_key', 'socialproofy_cronjob_init', 999, 0); 25 25 add_action('update_option_socialproofy_api_key', 'socialproofy_cronjob_init', 999, 0); 26 27 add_action('user_new_form', 'socialproofy_new_user', 999); 26 28 27 29 add_action('woocommerce_checkout_order_processed', 'socialproofy_new_order', 999, 3); … … 41 43 socialproofy_send_customers(); 42 44 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' => $offset62 ));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' => $products75 );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' => $customers97 );98 socialproofy_post($post_data);99 45 } 100 46 } … … 448 394 'customer_id' => $user_id, 449 395 'nickname' => $customer_data['nickname'], 450 'first_name' => $customer_data['first_name'],396 'first_name' => ucfirst($customer_data['first_name']), 451 397 'country' => $customer_data['billing_country'], 452 398 'city' => $customer_data['billing_city'], … … 465 411 466 412 socialproofy_post($post_data); 413 } 414 415 function 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 423 function 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 } 467 456 } 468 457 … … 485 474 'orders' => $orders, 486 475 )); 476 } 477 478 function 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 } 487 496 } 488 497
Note: See TracChangeset
for help on using the changeset viewer.