Plugin Directory

Changeset 3008850


Ignore:
Timestamp:
12/12/2023 02:52:19 PM (2 years ago)
Author:
gleap
Message:

Gleap v13.0.1

Location:
gleap/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gleap/trunk/README.txt

    r3008603 r3008850  
    44Requires at least: 5.0.0
    55Tested up to: 6.4.2
    6 Stable tag: 13.0.0
     6Stable tag: 13.0.1
    77License: Commercial
    88License URI: https://github.com/Gleap/Wordpress/blob/main/README.txt
     
    3838
    3939== Changelog ==
     40
     41= 13.0.1 =
     42* Added filter to inject custom user data.
     43
     44function add_custom_data_to_gleap_identify($data) {
     45    $user_group = \Groups_Helper::get_group_for_current_user();
     46
     47    if($user_group) {
     48        $data['customData']['mandat'] = $user_group->ap_mandant;
     49    }
     50
     51    return $data;
     52}
     53add_filter('gleap_identify_data', 'add_custom_data_to_gleap_identify');
    4054
    4155= 13.0.0 =
  • gleap/trunk/gleap.php

    r3008603 r3008850  
    1717 * Plugin Name:       Gleap
    1818 * Description:       Gleap helps developers build the best software faster. It is your affordable in-app bug reporting tool for apps, websites and industrial applications.
    19  * Version:           13.0.0
     19 * Version:           13.0.1
    2020 * Author:            Gleap
    2121 * Author URI:        https://www.gleap.io
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'GLEAP_VERSION', '13.0.0' );
     38define( 'GLEAP_VERSION', '13.0.1' );
    3939
    4040/**
  • gleap/trunk/public/class-gleap-public.php

    r3008603 r3008850  
    7777    }
    7878
     79    /**
     80     * Prepare the data for the Gleap.identify call.
     81     *
     82     * @since    1.0.0
     83     */
     84    private function prepare_gleap_identify_data() {
     85        if (!is_user_logged_in()) {
     86            return '';
     87        }
     88
     89        $user_data = get_userdata(get_current_user_id());
     90        $login = $user_data->user_login;
     91        $uname = $user_data->user_firstname . ' ' . $user_data->user_lastname;
     92        $nickname = (strlen($user_data->nickname) > 1) ? $user_data->nickname : '';
     93        $name = (strlen($uname) > 1) ? $uname : $nickname;
     94        $email = $user_data->user_email;
     95
     96        // Prepare the default data array.
     97        $data = array(
     98            'name' => $name,
     99            'email' => $email,
     100        );
     101
     102        // Allow other plugins to add or modify data.
     103        $data = apply_filters('gleap_identify_data', $data);
     104
     105        return $data;
     106    }
     107
    79108    /**
    80109     * Register the JavaScript for the public-facing side of the site.
     
    106135
    107136            $identify_script = "";
    108             $gleap_identity_token = carbon_get_theme_option('gleap_identity_token');
    109137            if (is_user_logged_in()) {
    110                 $user_data = get_userdata(get_current_user_id());
    111                 $login = $user_data->user_login;
    112                 $uname = $user_data->user_firstname . ' ' . $user_data->user_lastname;
    113                 $nickname = (strlen($user_data->nickname) > 1) ? $user_data->nickname : '';
    114                 $name = (strlen($uname) > 1) ? $uname : $nickname;
    115                 $email = $user_data->user_email;
    116                 $signature = hash_hmac('sha256', $login, $gleap_identity_token);
    117                 $identify_script = ',Gleap.identify("' . $login . '", { name: "' . $name . '", email: "' . $email . '"}, "' . $signature . '");';
     138                $gleap_identity_token = carbon_get_theme_option('gleap_identity_token');
     139                $user_data = get_userdata(get_current_user_id());
     140                $login = $user_data->user_login;
     141                $signature = hash_hmac('sha256', $login, $gleap_identity_token);
     142
     143                // Get the data for Gleap.identify.
     144                $identify_data = $this->prepare_gleap_identify_data();
     145                $identify_json = json_encode($identify_data);
     146
     147                $identify_script = ',Gleap.identify("' . $login . '", ' . $identify_json . ', "' . $signature . '");';
    118148            }
    119149
Note: See TracChangeset for help on using the changeset viewer.