Changeset 2575552
- Timestamp:
- 07/30/2021 10:41:55 PM (5 years ago)
- Location:
- servicebot
- Files:
-
- 6 edited
- 1 copied
-
tags/2.1.1 (copied) (copied from servicebot/trunk)
-
tags/2.1.1/README.txt (modified) (2 diffs)
-
tags/2.1.1/public/class-servicebot-public.php (modified) (2 diffs)
-
tags/2.1.1/servicebot.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/public/class-servicebot-public.php (modified) (2 diffs)
-
trunk/servicebot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
servicebot/tags/2.1.1/README.txt
r2529292 r2575552 3 3 Tags: stripe,subscriptions,payments,pricing page,subscription management 4 4 Requires at least: 5.0 5 Tested up to: 5. 5.15 Tested up to: 5.8.0 6 6 Requires PHP: 7.1 7 7 License: GPLv2 … … 97 97 = Can I change the style of these pages? = 98 98 99 Yes you can, check out our docs here to learn more about styling these pages [here](https://docs.billflow.io/ subscription-portal/pricing-page/customize-style-and-features-of-pricing-page).99 Yes you can, check out our docs here to learn more about styling these pages [here](https://docs.billflow.io/how-to/change-style). 100 100 101 101 = Where is the documentation for the plugin? = 102 102 103 Join us [here](https://docs.billflow.io/ subscription-portal/integrations/wordpress), and feel free to message us on our website with any questions.103 Join us [here](https://docs.billflow.io/no-code-integrations/no-code-app-builders/wordpress), and feel free to message us on our website with any questions. 104 104 105 105 == Screenshots == -
servicebot/tags/2.1.1/public/class-servicebot-public.php
r2458625 r2575552 117 117 } 118 118 119 } 120 121 function billflow_log_in_user($user_id, $email, $user_login, $password){ 122 123 $wp_auth = wp_authenticate($user_login, $password); 124 125 if(is_wp_error($wp_auth)){ 126 // this is probably someone else used the same email OR put in the wrong password. 127 wp_send_json_error( array( 128 'email' => $email, 129 'user_already_exists' => true, 130 'password_match' => false 131 ), 401 ); 132 }else{ 133 // Login the new user 134 wp_clear_auth_cookie(); 135 wp_set_current_user ( $user_id ); // Set the current user detail 136 wp_set_auth_cookie ( $user_id ); // Set auth details in cookie 137 138 // remove the meta that indicates need password update because they got the right password already 139 delete_user_meta($user_id, "billflow_stripe_webhook_created"); 140 141 wp_send_json( array( 142 'email' => $email, 143 'user_id' => $user_id, 144 'user_login' => $user_login, 145 'password' => '****************************', 146 'login_user_by_password' => true, 147 'refresh'=> true 148 ), 200 ); 149 } 119 150 } 120 151 … … 158 189 ), 200 ); 159 190 }else{ 160 191 // try to fetch the user by email 192 $existing_user = get_user_by('email', $email); 161 193 // if user already exists 162 $existing_user = get_user_by('email', $email);163 $user_id = $existing_user->get('id');164 // if the user hasn't been updated with a password165 if(get_user_meta( $user_id, "billflow_stripe_webhook_created", TRUE )){166 // and if the user has the matching subscription167 if(get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE) === $subscription_id){168 // remove the meta that indicates need password update169 delete_user_meta($user->get('id'), "billflow_stripe_webhook_created");170 // update the password171 wp_set_password($password, $user_id);172 // Login the new user173 wp_clear_auth_cookie();174 wp_set_current_user ( $user_id ); // Set the current user detail175 wp_set_auth_cookie ( $user_id ); // Set auth details in cookie176 177 wp_send_json( array( 'email' => $email,178 'user_already_exists' => true,179 'password_updated' => true,180 ), 200 );194 if($existing_user){ 195 $user_id = $existing_user->get('id'); 196 $user_login = $existing_user->get('user_login'); 197 198 // if the user hasn't been updated with a password 199 // this is when the user is just newly created by stripe webhook 200 if(get_user_meta( $user_id, "billflow_stripe_webhook_created", TRUE )){ 201 // and if the user has the matching subscription 202 if(get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE) === $subscription_id){ 203 // set the password automatically here because the subscription id matches. 204 wp_set_password($password, $user_id); 205 // Login the new user with the provided password 206 billflow_log_in_user($user_id, $email, $user_login, $password); 207 }else{ 208 // if the subscription id doesn't match 209 // still try login the user with the user input password to see if they are the owner 210 // because user exists, but provided a password. 211 billflow_log_in_user($user_id, $email, $user_login, $password); 212 } 181 213 }else{ 182 // the case if some one else put an existing email in. 183 wp_send_json_error( array( 'email' => $email, 184 'user_already_exists' => true, 185 'checkout_sid' => $subscription_id, 186 // 'existing_sid' => get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE), 187 'error' => 'User is created by webhook, but subscription does not match.', 188 ), 591 ); 214 // if user exists but not newly created by webhook 215 // because user exists, but provided a password. 216 billflow_log_in_user($user_id, $email, $user_login, $password); 189 217 } 190 218 }else{ 219 // WP_Error but not existing user, some other unhandled errors. 220 // for some reason other than an existing user with the same email. 191 221 wp_send_json_error( array( 'email' => $email, 192 'error' => 'Unable to create user.',193 ), 5 92);222 'error' => $user_id->get_error_message(), 223 ), 500 ); 194 224 } 195 225 } -
servicebot/tags/2.1.1/servicebot.php
r2565264 r2575552 17 17 * Plugin URI: http://www.wpexplorer.com/servicebot/ 18 18 * Description: Provides NO-CODE integration between WordPress and Billflow, an UI layer on top of Stripe Billing. 19 * Version: 2.1. 019 * Version: 2.1.1 20 20 * Author: Billflow 21 21 * Author URI: https://billflow.io … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'SERVICEBOT_VERSION', '2.1. 0' );38 define( 'SERVICEBOT_VERSION', '2.1.1' ); 39 39 40 40 /** -
servicebot/trunk/README.txt
r2529292 r2575552 3 3 Tags: stripe,subscriptions,payments,pricing page,subscription management 4 4 Requires at least: 5.0 5 Tested up to: 5. 5.15 Tested up to: 5.8.0 6 6 Requires PHP: 7.1 7 7 License: GPLv2 … … 97 97 = Can I change the style of these pages? = 98 98 99 Yes you can, check out our docs here to learn more about styling these pages [here](https://docs.billflow.io/ subscription-portal/pricing-page/customize-style-and-features-of-pricing-page).99 Yes you can, check out our docs here to learn more about styling these pages [here](https://docs.billflow.io/how-to/change-style). 100 100 101 101 = Where is the documentation for the plugin? = 102 102 103 Join us [here](https://docs.billflow.io/ subscription-portal/integrations/wordpress), and feel free to message us on our website with any questions.103 Join us [here](https://docs.billflow.io/no-code-integrations/no-code-app-builders/wordpress), and feel free to message us on our website with any questions. 104 104 105 105 == Screenshots == -
servicebot/trunk/public/class-servicebot-public.php
r2458625 r2575552 117 117 } 118 118 119 } 120 121 function billflow_log_in_user($user_id, $email, $user_login, $password){ 122 123 $wp_auth = wp_authenticate($user_login, $password); 124 125 if(is_wp_error($wp_auth)){ 126 // this is probably someone else used the same email OR put in the wrong password. 127 wp_send_json_error( array( 128 'email' => $email, 129 'user_already_exists' => true, 130 'password_match' => false 131 ), 401 ); 132 }else{ 133 // Login the new user 134 wp_clear_auth_cookie(); 135 wp_set_current_user ( $user_id ); // Set the current user detail 136 wp_set_auth_cookie ( $user_id ); // Set auth details in cookie 137 138 // remove the meta that indicates need password update because they got the right password already 139 delete_user_meta($user_id, "billflow_stripe_webhook_created"); 140 141 wp_send_json( array( 142 'email' => $email, 143 'user_id' => $user_id, 144 'user_login' => $user_login, 145 'password' => '****************************', 146 'login_user_by_password' => true, 147 'refresh'=> true 148 ), 200 ); 149 } 119 150 } 120 151 … … 158 189 ), 200 ); 159 190 }else{ 160 191 // try to fetch the user by email 192 $existing_user = get_user_by('email', $email); 161 193 // if user already exists 162 $existing_user = get_user_by('email', $email);163 $user_id = $existing_user->get('id');164 // if the user hasn't been updated with a password165 if(get_user_meta( $user_id, "billflow_stripe_webhook_created", TRUE )){166 // and if the user has the matching subscription167 if(get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE) === $subscription_id){168 // remove the meta that indicates need password update169 delete_user_meta($user->get('id'), "billflow_stripe_webhook_created");170 // update the password171 wp_set_password($password, $user_id);172 // Login the new user173 wp_clear_auth_cookie();174 wp_set_current_user ( $user_id ); // Set the current user detail175 wp_set_auth_cookie ( $user_id ); // Set auth details in cookie176 177 wp_send_json( array( 'email' => $email,178 'user_already_exists' => true,179 'password_updated' => true,180 ), 200 );194 if($existing_user){ 195 $user_id = $existing_user->get('id'); 196 $user_login = $existing_user->get('user_login'); 197 198 // if the user hasn't been updated with a password 199 // this is when the user is just newly created by stripe webhook 200 if(get_user_meta( $user_id, "billflow_stripe_webhook_created", TRUE )){ 201 // and if the user has the matching subscription 202 if(get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE) === $subscription_id){ 203 // set the password automatically here because the subscription id matches. 204 wp_set_password($password, $user_id); 205 // Login the new user with the provided password 206 billflow_log_in_user($user_id, $email, $user_login, $password); 207 }else{ 208 // if the subscription id doesn't match 209 // still try login the user with the user input password to see if they are the owner 210 // because user exists, but provided a password. 211 billflow_log_in_user($user_id, $email, $user_login, $password); 212 } 181 213 }else{ 182 // the case if some one else put an existing email in. 183 wp_send_json_error( array( 'email' => $email, 184 'user_already_exists' => true, 185 'checkout_sid' => $subscription_id, 186 // 'existing_sid' => get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE), 187 'error' => 'User is created by webhook, but subscription does not match.', 188 ), 591 ); 214 // if user exists but not newly created by webhook 215 // because user exists, but provided a password. 216 billflow_log_in_user($user_id, $email, $user_login, $password); 189 217 } 190 218 }else{ 219 // WP_Error but not existing user, some other unhandled errors. 220 // for some reason other than an existing user with the same email. 191 221 wp_send_json_error( array( 'email' => $email, 192 'error' => 'Unable to create user.',193 ), 5 92);222 'error' => $user_id->get_error_message(), 223 ), 500 ); 194 224 } 195 225 } -
servicebot/trunk/servicebot.php
r2565264 r2575552 17 17 * Plugin URI: http://www.wpexplorer.com/servicebot/ 18 18 * Description: Provides NO-CODE integration between WordPress and Billflow, an UI layer on top of Stripe Billing. 19 * Version: 2.1. 019 * Version: 2.1.1 20 20 * Author: Billflow 21 21 * Author URI: https://billflow.io … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'SERVICEBOT_VERSION', '2.1. 0' );38 define( 'SERVICEBOT_VERSION', '2.1.1' ); 39 39 40 40 /**
Note: See TracChangeset
for help on using the changeset viewer.