Plugin Directory

Changeset 3349871


Ignore:
Timestamp:
08/25/2025 04:43:55 PM (7 months ago)
Author:
gleap
Message:

Update to version 13.0.8 from GitHub

Location:
gleap
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • gleap/tags/13.0.8/README.txt

    r3342686 r3349871  
    44Requires at least: 5.0.0
    55Tested up to: 6.8.2
    6 Stable tag: 13.0.7
     6Stable tag: 13.0.8
    77License: Commercial
    88License URI: https://github.com/Gleap/Wordpress/blob/main/README.txt
     
    3838
    3939== Changelog ==
     40
     41= 13.0.8 =
     42* Added feature to restrict Gleap widget visibility by user role and for frontend/backend separately.
    4043
    4144= 13.0.7 =
  • gleap/tags/13.0.8/admin/class-gleap-admin.php

    r3258602 r3349871  
    7373
    7474    /**
     75     * Migrate old role settings to new separate frontend/admin role settings.
     76     * This ensures backward compatibility when updating from older plugin versions.
     77     * Uses proper Carbon Fields methods as per documentation.
     78     *
     79     * @since    1.0.0
     80     * @access   private
     81     */
     82    private function migrate_old_role_settings()
     83    {
     84        // Check if Carbon Fields functions are available
     85        if (!function_exists('carbon_get_theme_option') || !function_exists('carbon_set_theme_option')) {
     86            return;
     87        }
     88
     89        // Check if migration has already been performed
     90        $migration_done = get_option('gleap_role_migration_done', false);
     91        if ($migration_done) {
     92            return;
     93        }
     94
     95        // Get old role settings from database directly since these fields are no longer registered
     96        // Carbon Fields can't retrieve values for fields that aren't in the current schema
     97        $old_roles_only = get_option('_gleap_selected_roles_only', null);
     98        $old_selected_roles_raw = get_option('_gleap_selected_roles|||0|value', null);
     99       
     100        // Convert the selected roles to array format
     101        $old_selected_roles = null;
     102        if ($old_selected_roles_raw !== null && $old_selected_roles_raw !== '') {
     103            $old_selected_roles = array($old_selected_roles_raw);
     104        }
     105
     106        // Log what we found for debugging
     107        error_log('Gleap Migration: Found old database values - roles_only=' . var_export($old_roles_only, true) . ', selected_roles_raw=' . var_export($old_selected_roles_raw, true) . ', selected_roles=' . var_export($old_selected_roles, true));
     108
     109        // Check if we got the expected data types and values
     110        $has_valid_roles_only = ($old_roles_only === 'yes');
     111        $has_valid_selected_roles = !empty($old_selected_roles);
     112
     113        // Only migrate if old settings exist and have meaningful values
     114        if ($has_valid_roles_only) {
     115            // Convert to boolean (Carbon Fields stores checkbox as 'yes'/'no' or boolean)
     116            $roles_only_bool = true; // We know it's enabled if we got here
     117           
     118            // Ensure selected roles is an array
     119            if (!is_array($old_selected_roles)) {
     120                $old_selected_roles = $old_selected_roles ? array($old_selected_roles) : array();
     121            }
     122           
     123            // Migrate to new frontend settings using direct database insertion (Carbon Fields format)
     124            // Since carbon_set_theme_option might not work during field registration,
     125            // we'll set the values directly in the database using Carbon Fields format
     126           
     127            // Frontend roles only checkbox
     128            update_option('_gleap_frontend_selected_roles_only', $roles_only_bool ? 'yes' : 'no');
     129           
     130            // Frontend selected roles multiselect
     131            if (!empty($old_selected_roles)) {
     132                // For multiselect fields, Carbon Fields stores each value with |||index|value format
     133                foreach ($old_selected_roles as $index => $role) {
     134                    update_option('_gleap_frontend_selected_roles|||' . $index . '|value', $role);
     135                }
     136            }
     137
     138            // Admin roles only checkbox 
     139            update_option('_gleap_admin_selected_roles_only', $roles_only_bool ? 'yes' : 'no');
     140           
     141            // Admin selected roles multiselect
     142            if (!empty($old_selected_roles)) {
     143                // For multiselect fields, Carbon Fields stores each value with |||index|value format
     144                foreach ($old_selected_roles as $index => $role) {
     145                    update_option('_gleap_admin_selected_roles|||' . $index . '|value', $role);
     146                }
     147            }
     148
     149            // Mark migration as completed
     150            update_option('gleap_role_migration_done', true);
     151           
     152            // Log successful migration
     153            error_log('Gleap Migration: Successfully migrated role settings to separate frontend/admin controls');
     154        } else {
     155            // Log when no migration is performed
     156            error_log('Gleap Migration: No migration performed - roles_only=' . var_export($old_roles_only, true) . ', has_valid_roles_only=' . var_export($has_valid_roles_only, true));
     157        }
     158    }
     159
     160    /**
     161     * Reset migration flag - useful for development/testing
     162     * This method can be called to force re-migration of settings
     163     *
     164     * @since    1.0.0
     165     */
     166    public function reset_migration_flag() {
     167        delete_option('gleap_role_migration_done');
     168        error_log('Gleap Migration: Reset migration flag - next admin page visit will trigger migration');
     169    }
     170
     171    /**
    75172     * Register the stylesheets for the admin area.
    76173     *
     
    126223
    127224            if ($gleap_token) {
    128                 $gleap_selected_roles_only = carbon_get_theme_option('gleap_selected_roles_only');
    129                 if ($gleap_selected_roles_only == true) {
     225                $gleap_admin_selected_roles_only = carbon_get_theme_option('gleap_admin_selected_roles_only');
     226                if ($gleap_admin_selected_roles_only == true) {
    130227                    $user_roles = wp_get_current_user()->roles;
    131                     $gleap_selected_roles = carbon_get_theme_option('gleap_selected_roles');
    132 
    133                     if (!array_intersect($user_roles, $gleap_selected_roles)) {
     228                    $gleap_admin_selected_roles = carbon_get_theme_option('gleap_admin_selected_roles');
     229
     230                    if (!array_intersect($user_roles, $gleap_admin_selected_roles)) {
    134231                        // If the user's role is not in the selected roles, don't show Gleap
    135232                        return;
     
    209306    public function setup_settings_ui()
    210307    {
     308        // Run migration when Carbon Fields is fully registered
     309        // This ensures all Carbon Fields functions are available as per v3.x docs
     310        $this->migrate_old_role_settings();
     311
    211312        // Get WordPress roles
    212313        $wp_roles = wp_roles();
     
    221322            Field::make('text', 'gleap_identity_token', 'Identity verification secret')->set_attribute('type', 'password')->set_help_text("If you'd like to verify the identity of your users, copy the code from Project -> Settings -> Security to the field above."),
    222323            Field::make('text', 'gleap_secret_api_token', 'Secret API token')->set_attribute('type', 'password')->set_help_text("If you'd like to use the Gleap Rest API to send events, copy the code from Project -> Settings -> Security to the field above."),
    223             Field::make('checkbox', 'gleap_selected_roles_only', 'Enable Gleap only for the selected WP roles')
     324            Field::make('checkbox', 'gleap_activate_in_frontend', 'Activate Gleap widget in Frontend')
     325                ->set_default_value(true)
     326                ->set_help_text('Enable the Gleap widget in the frontend area.'),
     327            Field::make('checkbox', 'gleap_frontend_selected_roles_only', 'Enable Gleap frontend only for selected WP roles')
    224328                ->set_default_value(false)
    225                 ->set_help_text('Gleap widget will only be visible for users with the selected roles. If no roles are selected, it will be visible to all users.'),
     329                ->set_help_text('Gleap widget will only be visible in frontend for users with the selected roles.')
     330                ->set_conditional_logic(array(
     331                    array(
     332                        'field' => 'gleap_activate_in_frontend',
     333                        'value' => true,
     334                        'compare' => '='
     335                    )
     336                )),
     337            Field::make('multiselect', 'gleap_frontend_selected_roles', 'Select roles for frontend')
     338                ->add_options($roles)
     339                ->set_conditional_logic(array(
     340                    array(
     341                        'field' => 'gleap_frontend_selected_roles_only',
     342                        'value' => true,
     343                        'compare' => '='
     344                    )
     345                )),
    226346            Field::make('checkbox', 'gleap_activate_in_admin', 'Activate Gleap widget in WP Admin')
    227347                ->set_default_value(false)
    228348                ->set_help_text('Enable the Gleap widget in the WordPress admin area.'),
    229             Field::make('checkbox', 'gleap_activate_in_frontend', 'Activate Gleap widget in Frontend')
    230                 ->set_default_value(true)
    231                 ->set_help_text('Enable the Gleap widget in the frontend area.'),
    232             Field::make('multiselect', 'gleap_selected_roles', 'Select roles')
     349            Field::make('checkbox', 'gleap_admin_selected_roles_only', 'Enable Gleap admin only for selected WP roles')
     350                ->set_default_value(false)
     351                ->set_help_text('Gleap widget will only be visible in WP admin for users with the selected roles.')
     352                ->set_conditional_logic(array(
     353                    array(
     354                        'field' => 'gleap_activate_in_admin',
     355                        'value' => true,
     356                        'compare' => '='
     357                    )
     358                )),
     359            Field::make('multiselect', 'gleap_admin_selected_roles', 'Select roles for admin')
    233360                ->add_options($roles)
    234361                ->set_conditional_logic(array(
    235362                    array(
    236                         'field' => 'gleap_selected_roles_only',
     363                        'field' => 'gleap_admin_selected_roles_only',
    237364                        'value' => true,
    238365                        'compare' => '='
  • gleap/tags/13.0.8/gleap.php

    r3342686 r3349871  
    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.7
     19 * Version:           13.0.8
    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.7');
     38define('GLEAP_VERSION', '13.0.8');
    3939
    4040/**
  • gleap/tags/13.0.8/public/class-gleap-public.php

    r3258602 r3349871  
    173173            }
    174174
    175             $gleap_selected_roles_only = carbon_get_theme_option('gleap_selected_roles_only');
    176             if ($gleap_selected_roles_only == true) {
     175            $gleap_frontend_selected_roles_only = carbon_get_theme_option('gleap_frontend_selected_roles_only');
     176            if ($gleap_frontend_selected_roles_only == true) {
    177177                $user_roles = wp_get_current_user()->roles;
    178                 $gleap_selected_roles = carbon_get_theme_option('gleap_selected_roles');
    179 
    180                 if (!array_intersect($user_roles, $gleap_selected_roles)) {
     178                $gleap_frontend_selected_roles = carbon_get_theme_option('gleap_frontend_selected_roles');
     179
     180                if (!array_intersect($user_roles, $gleap_frontend_selected_roles)) {
    181181                    // If the user's role is not in the selected roles, don't show Gleap
    182182                    return;
  • gleap/tags/13.0.8/vendor/composer/installed.php

    r3342686 r3349871  
    22    'root' => array(
    33        'name' => 'gleap/gleap-wp',
    4         'pretty_version' => 'v13.0.7',
    5         'version' => '13.0.7.0',
    6         'reference' => '47d37dbe86166e0230bbea272f019de7d84820ff',
     4        'pretty_version' => 'v13.0.8',
     5        'version' => '13.0.8.0',
     6        'reference' => '6fd697a9b9e96e20cbbeac8ecfd7b1028b71e623',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'gleap/gleap-wp' => array(
    14             'pretty_version' => 'v13.0.7',
    15             'version' => '13.0.7.0',
    16             'reference' => '47d37dbe86166e0230bbea272f019de7d84820ff',
     14            'pretty_version' => 'v13.0.8',
     15            'version' => '13.0.8.0',
     16            'reference' => '6fd697a9b9e96e20cbbeac8ecfd7b1028b71e623',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • gleap/trunk/README.txt

    r3342686 r3349871  
    44Requires at least: 5.0.0
    55Tested up to: 6.8.2
    6 Stable tag: 13.0.7
     6Stable tag: 13.0.8
    77License: Commercial
    88License URI: https://github.com/Gleap/Wordpress/blob/main/README.txt
     
    3838
    3939== Changelog ==
     40
     41= 13.0.8 =
     42* Added feature to restrict Gleap widget visibility by user role and for frontend/backend separately.
    4043
    4144= 13.0.7 =
  • gleap/trunk/admin/class-gleap-admin.php

    r3258602 r3349871  
    7373
    7474    /**
     75     * Migrate old role settings to new separate frontend/admin role settings.
     76     * This ensures backward compatibility when updating from older plugin versions.
     77     * Uses proper Carbon Fields methods as per documentation.
     78     *
     79     * @since    1.0.0
     80     * @access   private
     81     */
     82    private function migrate_old_role_settings()
     83    {
     84        // Check if Carbon Fields functions are available
     85        if (!function_exists('carbon_get_theme_option') || !function_exists('carbon_set_theme_option')) {
     86            return;
     87        }
     88
     89        // Check if migration has already been performed
     90        $migration_done = get_option('gleap_role_migration_done', false);
     91        if ($migration_done) {
     92            return;
     93        }
     94
     95        // Get old role settings from database directly since these fields are no longer registered
     96        // Carbon Fields can't retrieve values for fields that aren't in the current schema
     97        $old_roles_only = get_option('_gleap_selected_roles_only', null);
     98        $old_selected_roles_raw = get_option('_gleap_selected_roles|||0|value', null);
     99       
     100        // Convert the selected roles to array format
     101        $old_selected_roles = null;
     102        if ($old_selected_roles_raw !== null && $old_selected_roles_raw !== '') {
     103            $old_selected_roles = array($old_selected_roles_raw);
     104        }
     105
     106        // Log what we found for debugging
     107        error_log('Gleap Migration: Found old database values - roles_only=' . var_export($old_roles_only, true) . ', selected_roles_raw=' . var_export($old_selected_roles_raw, true) . ', selected_roles=' . var_export($old_selected_roles, true));
     108
     109        // Check if we got the expected data types and values
     110        $has_valid_roles_only = ($old_roles_only === 'yes');
     111        $has_valid_selected_roles = !empty($old_selected_roles);
     112
     113        // Only migrate if old settings exist and have meaningful values
     114        if ($has_valid_roles_only) {
     115            // Convert to boolean (Carbon Fields stores checkbox as 'yes'/'no' or boolean)
     116            $roles_only_bool = true; // We know it's enabled if we got here
     117           
     118            // Ensure selected roles is an array
     119            if (!is_array($old_selected_roles)) {
     120                $old_selected_roles = $old_selected_roles ? array($old_selected_roles) : array();
     121            }
     122           
     123            // Migrate to new frontend settings using direct database insertion (Carbon Fields format)
     124            // Since carbon_set_theme_option might not work during field registration,
     125            // we'll set the values directly in the database using Carbon Fields format
     126           
     127            // Frontend roles only checkbox
     128            update_option('_gleap_frontend_selected_roles_only', $roles_only_bool ? 'yes' : 'no');
     129           
     130            // Frontend selected roles multiselect
     131            if (!empty($old_selected_roles)) {
     132                // For multiselect fields, Carbon Fields stores each value with |||index|value format
     133                foreach ($old_selected_roles as $index => $role) {
     134                    update_option('_gleap_frontend_selected_roles|||' . $index . '|value', $role);
     135                }
     136            }
     137
     138            // Admin roles only checkbox 
     139            update_option('_gleap_admin_selected_roles_only', $roles_only_bool ? 'yes' : 'no');
     140           
     141            // Admin selected roles multiselect
     142            if (!empty($old_selected_roles)) {
     143                // For multiselect fields, Carbon Fields stores each value with |||index|value format
     144                foreach ($old_selected_roles as $index => $role) {
     145                    update_option('_gleap_admin_selected_roles|||' . $index . '|value', $role);
     146                }
     147            }
     148
     149            // Mark migration as completed
     150            update_option('gleap_role_migration_done', true);
     151           
     152            // Log successful migration
     153            error_log('Gleap Migration: Successfully migrated role settings to separate frontend/admin controls');
     154        } else {
     155            // Log when no migration is performed
     156            error_log('Gleap Migration: No migration performed - roles_only=' . var_export($old_roles_only, true) . ', has_valid_roles_only=' . var_export($has_valid_roles_only, true));
     157        }
     158    }
     159
     160    /**
     161     * Reset migration flag - useful for development/testing
     162     * This method can be called to force re-migration of settings
     163     *
     164     * @since    1.0.0
     165     */
     166    public function reset_migration_flag() {
     167        delete_option('gleap_role_migration_done');
     168        error_log('Gleap Migration: Reset migration flag - next admin page visit will trigger migration');
     169    }
     170
     171    /**
    75172     * Register the stylesheets for the admin area.
    76173     *
     
    126223
    127224            if ($gleap_token) {
    128                 $gleap_selected_roles_only = carbon_get_theme_option('gleap_selected_roles_only');
    129                 if ($gleap_selected_roles_only == true) {
     225                $gleap_admin_selected_roles_only = carbon_get_theme_option('gleap_admin_selected_roles_only');
     226                if ($gleap_admin_selected_roles_only == true) {
    130227                    $user_roles = wp_get_current_user()->roles;
    131                     $gleap_selected_roles = carbon_get_theme_option('gleap_selected_roles');
    132 
    133                     if (!array_intersect($user_roles, $gleap_selected_roles)) {
     228                    $gleap_admin_selected_roles = carbon_get_theme_option('gleap_admin_selected_roles');
     229
     230                    if (!array_intersect($user_roles, $gleap_admin_selected_roles)) {
    134231                        // If the user's role is not in the selected roles, don't show Gleap
    135232                        return;
     
    209306    public function setup_settings_ui()
    210307    {
     308        // Run migration when Carbon Fields is fully registered
     309        // This ensures all Carbon Fields functions are available as per v3.x docs
     310        $this->migrate_old_role_settings();
     311
    211312        // Get WordPress roles
    212313        $wp_roles = wp_roles();
     
    221322            Field::make('text', 'gleap_identity_token', 'Identity verification secret')->set_attribute('type', 'password')->set_help_text("If you'd like to verify the identity of your users, copy the code from Project -> Settings -> Security to the field above."),
    222323            Field::make('text', 'gleap_secret_api_token', 'Secret API token')->set_attribute('type', 'password')->set_help_text("If you'd like to use the Gleap Rest API to send events, copy the code from Project -> Settings -> Security to the field above."),
    223             Field::make('checkbox', 'gleap_selected_roles_only', 'Enable Gleap only for the selected WP roles')
     324            Field::make('checkbox', 'gleap_activate_in_frontend', 'Activate Gleap widget in Frontend')
     325                ->set_default_value(true)
     326                ->set_help_text('Enable the Gleap widget in the frontend area.'),
     327            Field::make('checkbox', 'gleap_frontend_selected_roles_only', 'Enable Gleap frontend only for selected WP roles')
    224328                ->set_default_value(false)
    225                 ->set_help_text('Gleap widget will only be visible for users with the selected roles. If no roles are selected, it will be visible to all users.'),
     329                ->set_help_text('Gleap widget will only be visible in frontend for users with the selected roles.')
     330                ->set_conditional_logic(array(
     331                    array(
     332                        'field' => 'gleap_activate_in_frontend',
     333                        'value' => true,
     334                        'compare' => '='
     335                    )
     336                )),
     337            Field::make('multiselect', 'gleap_frontend_selected_roles', 'Select roles for frontend')
     338                ->add_options($roles)
     339                ->set_conditional_logic(array(
     340                    array(
     341                        'field' => 'gleap_frontend_selected_roles_only',
     342                        'value' => true,
     343                        'compare' => '='
     344                    )
     345                )),
    226346            Field::make('checkbox', 'gleap_activate_in_admin', 'Activate Gleap widget in WP Admin')
    227347                ->set_default_value(false)
    228348                ->set_help_text('Enable the Gleap widget in the WordPress admin area.'),
    229             Field::make('checkbox', 'gleap_activate_in_frontend', 'Activate Gleap widget in Frontend')
    230                 ->set_default_value(true)
    231                 ->set_help_text('Enable the Gleap widget in the frontend area.'),
    232             Field::make('multiselect', 'gleap_selected_roles', 'Select roles')
     349            Field::make('checkbox', 'gleap_admin_selected_roles_only', 'Enable Gleap admin only for selected WP roles')
     350                ->set_default_value(false)
     351                ->set_help_text('Gleap widget will only be visible in WP admin for users with the selected roles.')
     352                ->set_conditional_logic(array(
     353                    array(
     354                        'field' => 'gleap_activate_in_admin',
     355                        'value' => true,
     356                        'compare' => '='
     357                    )
     358                )),
     359            Field::make('multiselect', 'gleap_admin_selected_roles', 'Select roles for admin')
    233360                ->add_options($roles)
    234361                ->set_conditional_logic(array(
    235362                    array(
    236                         'field' => 'gleap_selected_roles_only',
     363                        'field' => 'gleap_admin_selected_roles_only',
    237364                        'value' => true,
    238365                        'compare' => '='
  • gleap/trunk/gleap.php

    r3342686 r3349871  
    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.7
     19 * Version:           13.0.8
    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.7');
     38define('GLEAP_VERSION', '13.0.8');
    3939
    4040/**
  • gleap/trunk/public/class-gleap-public.php

    r3258602 r3349871  
    173173            }
    174174
    175             $gleap_selected_roles_only = carbon_get_theme_option('gleap_selected_roles_only');
    176             if ($gleap_selected_roles_only == true) {
     175            $gleap_frontend_selected_roles_only = carbon_get_theme_option('gleap_frontend_selected_roles_only');
     176            if ($gleap_frontend_selected_roles_only == true) {
    177177                $user_roles = wp_get_current_user()->roles;
    178                 $gleap_selected_roles = carbon_get_theme_option('gleap_selected_roles');
    179 
    180                 if (!array_intersect($user_roles, $gleap_selected_roles)) {
     178                $gleap_frontend_selected_roles = carbon_get_theme_option('gleap_frontend_selected_roles');
     179
     180                if (!array_intersect($user_roles, $gleap_frontend_selected_roles)) {
    181181                    // If the user's role is not in the selected roles, don't show Gleap
    182182                    return;
  • gleap/trunk/vendor/composer/installed.php

    r3342686 r3349871  
    22    'root' => array(
    33        'name' => 'gleap/gleap-wp',
    4         'pretty_version' => 'v13.0.7',
    5         'version' => '13.0.7.0',
    6         'reference' => '47d37dbe86166e0230bbea272f019de7d84820ff',
     4        'pretty_version' => 'v13.0.8',
     5        'version' => '13.0.8.0',
     6        'reference' => '6fd697a9b9e96e20cbbeac8ecfd7b1028b71e623',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'gleap/gleap-wp' => array(
    14             'pretty_version' => 'v13.0.7',
    15             'version' => '13.0.7.0',
    16             'reference' => '47d37dbe86166e0230bbea272f019de7d84820ff',
     14            'pretty_version' => 'v13.0.8',
     15            'version' => '13.0.8.0',
     16            'reference' => '6fd697a9b9e96e20cbbeac8ecfd7b1028b71e623',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.