Plugin Directory

Changeset 2575606


Ignore:
Timestamp:
07/31/2021 03:32:37 AM (5 years ago)
Author:
servicebot
Message:

Update to version 2.1.2 from GitHub

Location:
servicebot
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • servicebot/tags/2.1.2/public/class-servicebot-public.php

    r2575552 r2575606  
    119119}
    120120
    121 function billflow_log_in_user($user_id, $email, $user_login, $password){
     121function billflow_log_in_user($user_id, $email, $user_login, $password, $caller){
    122122   
    123123    $wp_auth = wp_authenticate($user_login, $password);
     
    128128            'email' => $email,
    129129            'user_already_exists' => true,
    130             'password_match' => false
     130            'password_match' => false,
     131            'caller' => $caller
    131132        ), 401 );
    132133    }else{
     
    145146            'password' => '****************************',
    146147            'login_user_by_password' => true,
    147             'refresh'=> true
     148            'refresh'=> true,
     149            'caller' => $caller
    148150        ), 200 );
    149151    }
    150152}
    151153
    152 
     154/**
     155 * create user function called by frontend widget ajax
     156 */
    153157function servicebot_ajax_create_user() {
    154158
     
    185189                                'name' => $name,
    186190                                'password' => '*****',
    187                                 'message' => 'User created successfully.',
     191                                'message' => 'User created successfully by ajax call',
    188192                                'refresh' => true
    189193                    ), 200 );
    190194    }else{
    191         // try to fetch the user by email
    192         $existing_user = get_user_by('email', $email);
    193195        // if user already exists
    194196        if($existing_user){
     
    196198            $user_login = $existing_user->get('user_login');
    197199       
    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                 }
    213             }else{
    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);
    217             }
     200            // if user exists but not newly created by webhook
     201            // because user exists and provided a password.
     202            billflow_log_in_user($user_id, $email, $user_login, $password, 'billflow_login_by_password');
     203
    218204        }else{
    219205            // WP_Error but not existing user, some other unhandled errors.
  • servicebot/tags/2.1.2/public/widgets/js/billflow-widget.js

    r2476695 r2575606  
    6868            window.location.replace(upgrade_url + "?redirect_to=" + window.location.pathname + window.location.search)
    6969        }else{
    70             // alert("Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default")
     70            console.error("[BF_ERROR] Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default")
    7171        }
    7272    }
     
    139139            }).done(function(){
    140140                resolve("created WP user successfully!")
    141             }).fail(function(){
     141            }).fail(function(jqXHR, textStatus, errorThrown){
     142                console.error("Billflow WP account creation encountered an error", jqXHR.responseText, textStatus, errorThrown);
    142143                reject("unable to create WP user!")
    143                 console.error("Billflow WP account creation encountered an error");
    144144            })
    145145        })
  • servicebot/tags/2.1.2/servicebot.php

    r2575552 r2575606  
    1717 * Plugin URI:        http://www.wpexplorer.com/servicebot/
    1818 * Description:       Provides NO-CODE integration between WordPress and Billflow, an UI layer on top of Stripe Billing.
    19  * Version:           2.1.1
     19 * Version:           2.1.2
    2020 * Author:            Billflow
    2121 * Author URI:        https://billflow.io
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'SERVICEBOT_VERSION', '2.1.1' );
     38define( 'SERVICEBOT_VERSION', '2.1.2' );
    3939
    4040/**
  • servicebot/trunk/public/class-servicebot-public.php

    r2575552 r2575606  
    119119}
    120120
    121 function billflow_log_in_user($user_id, $email, $user_login, $password){
     121function billflow_log_in_user($user_id, $email, $user_login, $password, $caller){
    122122   
    123123    $wp_auth = wp_authenticate($user_login, $password);
     
    128128            'email' => $email,
    129129            'user_already_exists' => true,
    130             'password_match' => false
     130            'password_match' => false,
     131            'caller' => $caller
    131132        ), 401 );
    132133    }else{
     
    145146            'password' => '****************************',
    146147            'login_user_by_password' => true,
    147             'refresh'=> true
     148            'refresh'=> true,
     149            'caller' => $caller
    148150        ), 200 );
    149151    }
    150152}
    151153
    152 
     154/**
     155 * create user function called by frontend widget ajax
     156 */
    153157function servicebot_ajax_create_user() {
    154158
     
    185189                                'name' => $name,
    186190                                'password' => '*****',
    187                                 'message' => 'User created successfully.',
     191                                'message' => 'User created successfully by ajax call',
    188192                                'refresh' => true
    189193                    ), 200 );
    190194    }else{
    191         // try to fetch the user by email
    192         $existing_user = get_user_by('email', $email);
    193195        // if user already exists
    194196        if($existing_user){
     
    196198            $user_login = $existing_user->get('user_login');
    197199       
    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                 }
    213             }else{
    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);
    217             }
     200            // if user exists but not newly created by webhook
     201            // because user exists and provided a password.
     202            billflow_log_in_user($user_id, $email, $user_login, $password, 'billflow_login_by_password');
     203
    218204        }else{
    219205            // WP_Error but not existing user, some other unhandled errors.
  • servicebot/trunk/public/widgets/js/billflow-widget.js

    r2476695 r2575606  
    6868            window.location.replace(upgrade_url + "?redirect_to=" + window.location.pathname + window.location.search)
    6969        }else{
    70             // alert("Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default")
     70            console.error("[BF_ERROR] Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default")
    7171        }
    7272    }
     
    139139            }).done(function(){
    140140                resolve("created WP user successfully!")
    141             }).fail(function(){
     141            }).fail(function(jqXHR, textStatus, errorThrown){
     142                console.error("Billflow WP account creation encountered an error", jqXHR.responseText, textStatus, errorThrown);
    142143                reject("unable to create WP user!")
    143                 console.error("Billflow WP account creation encountered an error");
    144144            })
    145145        })
  • servicebot/trunk/servicebot.php

    r2575552 r2575606  
    1717 * Plugin URI:        http://www.wpexplorer.com/servicebot/
    1818 * Description:       Provides NO-CODE integration between WordPress and Billflow, an UI layer on top of Stripe Billing.
    19  * Version:           2.1.1
     19 * Version:           2.1.2
    2020 * Author:            Billflow
    2121 * Author URI:        https://billflow.io
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'SERVICEBOT_VERSION', '2.1.1' );
     38define( 'SERVICEBOT_VERSION', '2.1.2' );
    3939
    4040/**
Note: See TracChangeset for help on using the changeset viewer.