Changeset 3261474
- Timestamp:
- 03/25/2025 11:12:55 AM (12 months ago)
- Location:
- doppler-for-learnpress
- Files:
-
- 80 added
- 5 edited
-
tags/1.0.12 (added)
-
tags/1.0.12/LICENSE.txt (added)
-
tags/1.0.12/README.txt (added)
-
tags/1.0.12/admin (added)
-
tags/1.0.12/admin/class-doppler-for-learnpress-admin.php (added)
-
tags/1.0.12/admin/css (added)
-
tags/1.0.12/admin/css/doppler-for-learnpress-admin.css (added)
-
tags/1.0.12/admin/css/doppler-for-learnpress-admin.scss (added)
-
tags/1.0.12/admin/css/fonts (added)
-
tags/1.0.12/admin/css/fonts.css (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-Bold.eot (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-Bold.ttf (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-Bold.woff (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-BoldIt.eot (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-BoldIt.ttf (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-BoldIt.woff (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-Regular.eot (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-Regular.ttf (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-Regular.woff (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-RegularIt.eot (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-RegularIt.ttf (added)
-
tags/1.0.12/admin/css/fonts/ProximaNova-RegularIt.woff (added)
-
tags/1.0.12/admin/img (added)
-
tags/1.0.12/admin/img/ajax-synch.gif (added)
-
tags/1.0.12/admin/img/icon-doppler-menu.png (added)
-
tags/1.0.12/admin/img/loading.gif (added)
-
tags/1.0.12/admin/img/logo-doppler.svg (added)
-
tags/1.0.12/admin/index.php (added)
-
tags/1.0.12/admin/js (added)
-
tags/1.0.12/admin/js/doppler-for-learnpress-admin.js (added)
-
tags/1.0.12/admin/js/doppler-styles.js (added)
-
tags/1.0.12/admin/partials (added)
-
tags/1.0.12/admin/partials/courses-mapping.php (added)
-
tags/1.0.12/admin/partials/doppler-for-learnpress-admin-display.php (added)
-
tags/1.0.12/admin/partials/settings.php (added)
-
tags/1.0.12/admin/partials/tabs-nav.php (added)
-
tags/1.0.12/doppler-for-learnpress.php (added)
-
tags/1.0.12/includes (added)
-
tags/1.0.12/includes/class-dependency-checker.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress-activator.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress-admin-notice.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress-app-connect.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress-deactivator.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress-i18n.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress-loader.php (added)
-
tags/1.0.12/includes/class-doppler-for-learnpress.php (added)
-
tags/1.0.12/includes/index.php (added)
-
tags/1.0.12/index.php (added)
-
tags/1.0.12/languages (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_AR.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_AR.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_CL.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_CL.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_CO.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_CO.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_CR.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_CR.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_DO.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_DO.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_EC.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_EC.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_ES.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_ES.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_GT.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_GT.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_MX.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_MX.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_PE.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_PE.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_PR.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_PR.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_UY.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_UY.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_VE.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress-es_VE.po (added)
-
tags/1.0.12/languages/doppler-for-learnpress.mo (added)
-
tags/1.0.12/languages/doppler-for-learnpress.pot (added)
-
tags/1.0.12/public (added)
-
tags/1.0.12/public/class-doppler-for-learnpress-public.php (added)
-
tags/1.0.12/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-doppler-for-learnpress-admin.php (modified) (9 diffs)
-
trunk/admin/js/doppler-for-learnpress-admin.js (modified) (1 diff)
-
trunk/admin/partials/doppler-for-learnpress-admin-display.php (modified) (2 diffs)
-
trunk/doppler-for-learnpress.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doppler-for-learnpress/trunk/README.txt
r3226551 r3261474 4 4 Tags: email marketing 5 5 Requires at least: 4.9 6 Tested up to: 6.7. 16 Tested up to: 6.7.2 7 7 Requires PHP: 5.6.4 8 Stable tag: 1.0.1 18 Stable tag: 1.0.12 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 14 14 == Changelog == 15 = 1.0.12 = 16 * Update: Add counter for syncronized contacts 17 15 18 = 1.0.11 = 16 19 * Update: Apply Doppler's style library -
doppler-for-learnpress/trunk/admin/class-doppler-for-learnpress-admin.php
r3166525 r3261474 240 240 241 241 if(empty($_POST['list_id'])) wp_die(); 242 243 242 $list_id = intval($_POST['list_id']); 244 243 $students = $this->get_students(); … … 248 247 wp_die(); 249 248 } 249 $studentsAmount = is_array($students) ? count($students) : 0; 250 250 $subscriber_resource = $this->doppler_service->getResource( 'subscribers' ); 251 251 $this->set_origin(); … … 258 258 259 259 if( !empty($map) ){ 260 $lists = $this->get_alpha_lists(); 260 261 foreach($map as $mapped_course){ 261 $course_id = $mapped_course['course_id']; 262 $students = $this->get_students_from_course ($course_id); 263 $result = $subscriber_resource->importSubscribers( $mapped_course['list_id'], $this->get_subscribers_for_import($students) )['body']; 264 } 265 } 266 267 echo $result; 262 if(isset($lists[$mapped_course['list_id']])) 263 { 264 $course_id = $mapped_course['course_id']; 265 $students = $this->get_students_from_course ($course_id); 266 $subscriber_resource->importSubscribers( $mapped_course['list_id'], $this->get_subscribers_for_import($students) )['body']; 267 } 268 } 269 } 270 271 echo json_encode(array('apiResponse' => $result, 'studentsCount' => $studentsAmount)); 268 272 wp_die(); 269 273 } … … 290 294 return array( 'email'=>$student->user_email, "fields" => array() ); 291 295 } 292 293 /**294 * Subscribe customer to list after295 * course subscription from fromt-end296 *297 * @since 1.0.0298 */299 /*300 public function dplr_after_customer_subscription( $order_id ) {301 echo 'dplr_after_customer_subscription';302 die();303 $order = new LP_Order( $order_id );304 $lists = get_option('dplr_learnpress_subscribers_list');305 if(!empty($lists)){306 $list_id = $lists['buyers'];307 $order = new LP_Order( $order_id );308 $user_data = get_userdata($order->user_id);309 $user_email = $user_data->data->user_email;310 $this->set_credentials();311 $this->subscribe_customer( $list_id, $user_email, array() );312 }313 }*/314 296 315 297 /** … … 332 314 //Subscribe to global buyers list. 333 315 $lists = get_option('dplr_learnpress_subscribers_list'); 334 $list_id = $lists['buyers']; 335 $this->subscribe_user_or_users($users, $list_id); 316 if (is_array($lists)) { 317 $list_id = $lists['buyers']; 318 $this->subscribe_user_or_users($users, $list_id); 319 $lists['count'] = intval($lists['count']) + (is_array($users) ? count($users) : 1); 320 update_option('dplr_learnpress_subscribers_list', $lists); 321 } 336 322 337 323 //Check if course is mapped for registering subscriptions and subscribe. 338 324 $map = get_option('dplr_learnpress_courses_map'); 339 325 if( !empty($map) ){ 340 foreach($map as $ mapped_course){326 foreach($map as $index => $mapped_course){ 341 327 foreach($order_items as $k=>$order_item){ 342 328 $course_id = $order_item['course_id']; … … 344 330 //Subscribe user or users 345 331 $this->subscribe_user_or_users($users, $mapped_course['list_id']); 332 333 //update counter 334 $mapped_course['count'] += (is_array($users) ? count($users) : 1); 335 $map[$index] = $mapped_course; 346 336 } 347 337 } 348 338 } 339 update_option('dplr_learnpress_courses_map', $map); 349 340 } 350 341 } … … 355 346 $list_id = $lists['buyers']; 356 347 $this->subscribe_user_or_users($users, $list_id, $user_email); 348 $lists['count'] += (is_array($users) ? count($users) : 1); 349 350 update_option('dplr_learnpress_courses_map', $lists); 357 351 358 352 $map = get_option('dplr_learnpress_courses_map'); 359 353 if( !empty($map) ){ 360 foreach($map as $ mapped_course){354 foreach($map as $index => $mapped_course){ 361 355 foreach($order_items as $k=>$order_item){ 362 356 $course_id = $order_item['course_id']; … … 364 358 //Subscribe user or users 365 359 $this->subscribe_user_or_users($users, $mapped_course['list_id'], $user_email); 360 361 //update counter 362 $mapped_course['count'] += (is_array($users) ? count($users) : 1); 363 $map[$index] = $mapped_course; 366 364 } 367 365 } 368 366 } 367 update_option('dplr_learnpress_courses_map', $map); 369 368 } 370 369 } … … 520 519 } 521 520 522 //TODO: action_id is always 1 atm. 523 //a course plus an action have an associated list 524 //$dplr_courses_map[][$_POST['course_id']][$_POST['action_id']] = $_POST['list_id']; 521 $students = $this->get_students_from_course ($_POST['course_id']); 522 $subscriber_resource = $this->doppler_service->getResource('subscribers'); 523 $subscribers = $this->get_subscribers_for_import($students); 524 $result = $subscriber_resource->importSubscribers( $_POST['list_id'], $subscribers )['body']; 525 525 526 $dplr_courses_map[] = array( 526 'course_id'=>$_POST['course_id'], 527 'action_id'=>$_POST['action_id'], 528 'list_id'=>$_POST['list_id'] 529 ); 530 if(update_option( 'dplr_learnpress_courses_map', $dplr_courses_map )){ 531 //Map, then synch! 532 $students = $this->get_students_from_course ($_POST['course_id']); 533 $subscriber_resource = $this->doppler_service->getResource('subscribers'); 534 $result = $subscriber_resource->importSubscribers( $_POST['list_id'], $this->get_subscribers_for_import($students) )['body']; 535 wp_send_json_success(); 536 } 527 'course_id'=>$_POST['course_id'], 528 'action_id'=>$_POST['action_id'], 529 'list_id'=>$_POST['list_id'], 530 'count'=>count($subscribers['items']) 531 ); 532 update_option('dplr_learnpress_courses_map', $dplr_courses_map); 533 534 wp_send_json_success(); 535 537 536 wp_die(); 538 537 } -
doppler-for-learnpress/trunk/admin/js/doppler-for-learnpress-admin.js
r3166525 r3261474 37 37 synchBuyers(buyersList).then(function (response) { 38 38 var obj = JSON.parse(response); 39 if (obj.createdResourceId || obj.errCode == "NoStudentsFound") { 39 if (JSON.parse(obj.apiResponse).createdResourceId || obj.errCode == "NoStudentsFound") { 40 $('<input>').attr({ 41 type: 'hidden', 42 id: 'counter', 43 name: 'dplr_learnpress_subscribers_list[count]', 44 value: obj.studentsCount 45 }).appendTo('#dplr-lp-form-list'); 46 40 47 $("#dplr-lp-form-list").submit(); 41 48 } else { -
doppler-for-learnpress/trunk/admin/partials/doppler-for-learnpress-admin-display.php
r3166525 r3261474 37 37 $active_tab = 'settings'; 38 38 39 if( isset($_POST['dplr_learnpress_subscribers_list']) && $this->validate_subscribers_list($_POST['dplr_learnpress_subscribers_list']) && current_user_can('manage_options') && check_admin_referer('map-lists') ){ 39 if( isset($_POST['dplr_learnpress_subscribers_list']) 40 && $this->validate_subscribers_list($_POST['dplr_learnpress_subscribers_list']) 41 && current_user_can('manage_options') 42 && check_admin_referer('map-lists') ) 43 { 40 44 update_option( 'dplr_learnpress_subscribers_list', $this->sanitize_subscribers_list($_POST['dplr_learnpress_subscribers_list']) ); 41 45 $this->set_success_message(__('Your List has been syncronized and saved succesfully.', 'doppler-for-learnpress')); … … 49 53 50 54 require_once('settings.php'); 51 52 53 55 ?> 54 56 -
doppler-for-learnpress/trunk/doppler-for-learnpress.php
r3166525 r3261474 11 11 * Plugin URI: www.fromdoppler.com 12 12 * Description: Submit your LearnPress students to a Doppler Lists. 13 * Version: 1.0.1 113 * Version: 1.0.12 14 14 * Author: Doppler 15 15 * License: GPL-2.0+ … … 24 24 } 25 25 26 define( 'DOPPLER_FOR_LEARNPRESS_VERSION', '1.0.1 1' );26 define( 'DOPPLER_FOR_LEARNPRESS_VERSION', '1.0.12' ); 27 27 define( 'DOPPLER_FOR_LEARNPRESS_PLUGIN_FILE', plugin_basename( __FILE__ )); 28 28 define( 'DOPPLER_FOR_LEARNPRESS_URL', plugin_dir_url(__FILE__) );
Note: See TracChangeset
for help on using the changeset viewer.