Changeset 2691440
- Timestamp:
- 03/09/2022 12:26:58 PM (4 years ago)
- Location:
- fast-thrivecart/trunk
- Files:
-
- 3 edited
-
fast-thrivecart.php (modified) (1 diff)
-
includes/class.thrivecart-core.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fast-thrivecart/trunk/fast-thrivecart.php
r2592143 r2691440 4 4 * Plugin URI: https://fastflow.io/products/fast-thrivecart 5 5 * Description: ThriveCart payments Integration 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: fastflow.io 8 8 * Author URI: https://fastflow.io -
fast-thrivecart/trunk/includes/class.thrivecart-core.php
r2592143 r2691440 7 7 class FastThriveCart_core { 8 8 9 private $ thrivecart_url;9 private $new_wp_user; 10 10 private $fast_thrivecart_apikey; 11 11 12 12 public function __construct(){ 13 $this-> thrivecart_url = '';13 $this->new_wp_user = false; 14 14 $this->fast_thrivecart_apikey(); 15 15 add_action('admin_notices', array($this, 'fast_thrivecart_admin_notice__error')); … … 124 124 $log_var = "<pre>" . print_r($prods_data, true) . "</pre>"; 125 125 error_log("ThriveCart webhook products".$log_var); 126 $userid = $this->fast_thrivecart_process_user($prods_data, $raw_data_obj); 126 $livepass = wp_generate_password(); 127 $userid = $this->fast_thrivecart_process_user($prods_data, $raw_data_obj, $livepass); 127 128 $this->fast_thrivecart_process_fm_user($userid, $prods_data, $raw_data_obj, $raw_data_obj['transactions'][$product['item_type'].'-'.$product['reference']], $product['amount_gross_str']); 129 $this->fast_thrivecart_send_welcome_email($userid, $prods_data, $livepass); 128 130 } 129 131 } … … 132 134 } 133 135 134 public function fast_thrivecart_process_user($prods_data, $data ){136 public function fast_thrivecart_process_user($prods_data, $data, $generated_pass){ 135 137 global $wpdb; 136 138 $chk_user = get_user_by( 'email', $data['customer']['email'] ); … … 138 140 $userid = $chk_user->ID; 139 141 } else { 140 $ generated_pass = wp_generate_password();142 $this->new_wp_user = true; 141 143 $setpass = $generated_pass; 142 144 $username = $data['customer']['email']; … … 259 261 } 260 262 } 261 do_action( 'FM_after_transaction_recorded', $txn_idx_id, $pid, $userid ); 262 } 263 } 263 do_action( 'FM_after_transaction_recorded', $txn_idx_id, $pid, $userid ); 264 } 265 } 266 267 private function fast_thrivecart_send_welcome_email($userid, $prodsq, $livepass) { 268 $subj = $prodsq->notif_welcome_subj; 269 if (!$subj) { $subj = _fm('Login Details') .' - '.$prodsq->title; } 270 $mailmsg = $prodsq->notif_welcome; 271 $existpass = "[hidden]<br/>You have previously registered on the site.<br/>Please use your existing password!<br/>If you do not remember your password you can retrieve it here:<br/>" .wp_lostpassword_url()."<br/><br/>"; 272 $passphrase = $this->new_wp_user ? $livepass : $existpass; 273 $userdata = get_userdata($userid); 274 $subj = str_replace('[email]', $userdata->user_email, $subj); 275 $subj = str_replace('[login]', $userdata->user_login, $subj); 276 $subj = str_replace('[pass]', $passphrase, $subj); 277 $subj = str_replace('[first_name]', get_user_meta($userid,'first_name', true), $subj); 278 $subj = str_replace('[last_name]', get_user_meta($userid,'last_name', true), $subj); 279 $subj = str_replace('[product_name]', $prodsq->title, $subj); 280 $mailmsg = str_replace('[email]', $userdata->user_email, $mailmsg); 281 $mailmsg = str_replace('[login]', $userdata->user_login, $mailmsg); 282 $mailmsg = str_replace('[pass]', $passphrase, $mailmsg); 283 $mailmsg = str_replace('[first_name]', get_user_meta($userid,'first_name', true), $mailmsg); 284 $mailmsg = str_replace('[last_name]', get_user_meta($userid,'last_name', true), $mailmsg); 285 $mailmsg = str_replace('[product_name]', $prodsq->title, $mailmsg); 286 $postid = $prodsq->loginpage; 287 if (!$postid) { 288 global $wpdb; 289 $postid = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}posts WHERE post_content 290 like '%[fastmemloginform product=\"$prodsq->id\"]%' AND 291 post_status='publish' AND 292 (post_type='page' OR post_type='post')"); 293 } 294 if ($postid) { $url = get_permalink($postid); 295 } else { $url = site_url('/wp-login.php'); } 296 $mailmsg = str_replace('[loginurl]', $url, $mailmsg); 297 if($prodsq->if_notif_welcome == 1){ 298 fastmemSendMail($userdata->user_email, $subj, $mailmsg, $prodsq->sendername, $prodsq->senderemail); 299 } 300 } 264 301 265 302 private function fast_thrivecart_get_membership_expiry_date($userid, $prodsq, $now) { -
fast-thrivecart/trunk/readme.txt
r2593143 r2691440 4 4 Tags: FastFlow, Fast Member, ThriveCart, Sales Funnels, Marketing 5 5 Requires at least: 4.0 6 Tested up to: 5. 86 Tested up to: 5.9 7 7 Stable tag: 1.0.3 8 8 Requires PHP: 5.3 … … 14 14 == Description == 15 15 16 [youtube17 https://www.youtube.com/watch?v=PRnbY6-vnbc]18 19 16 Fast ThriveCart is a FastFlow add on for Fast Member. Now you can quickly and easily integrate your ThriveCart products with Fast Member and add your new customers to your WordPress membership site. 20 17 21 Once your customers purchase through ThriveCart they are immediately added to WordPress and your chosen Fast Member products. There is support for order bumps and upsells, giving you integration ac ross your entire sales funnel.18 Once your customers purchase through ThriveCart they are immediately added to WordPress and your chosen Fast Member products. There is support for order bumps and upsells, giving you integration accross your entire slaes funnel. 22 19 23 20 … … 47 44 == Changelog == 48 45 46 = 1.0.4 = 47 48 Email sending fix 49 49 50 = 1.0.3 = 50 51
Note: See TracChangeset
for help on using the changeset viewer.