Plugin Directory

Changeset 2936394


Ignore:
Timestamp:
07/10/2023 08:14:45 AM (3 years ago)
Author:
gleap
Message:

committing version 11.0.0 to trunk

Location:
gleap/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gleap/trunk/README.txt

    r2894111 r2936394  
    33Tags: bug-tracking, bug-reporting, user-feedback, support, feedback, customer-feedback, live-chat, chat
    44Requires at least: 4.1.5
    5 Tested up to: 6.2.0
    6 Stable tag: 9.0.0
     5Tested up to: 6.2.2
     6Stable tag: 11.0.0
    77License: Commercial
    88License URI: https://github.com/Gleap/Wordpress/blob/main/README.txt
     
    3939== Changelog ==
    4040
    41 = 9.0.0 =
    42 * Updated to Gleap Widget 9.0.0
     41= 11.0.0 =
     42* Added permission based widget toggle.
    4343
    4444= 8.0.5 =
  • gleap/trunk/admin/class-gleap-admin.php

    r2813372 r2936394  
    121121    public function setup_settings_ui()
    122122    {
     123        // Get WordPress roles
     124        $wp_roles = wp_roles();
     125        $roles = array();
     126        foreach($wp_roles->roles as $role => $details){
     127            $roles[$role] = translate_user_role($details['name']);
     128        }
     129   
    123130        Container::make('theme_options', __('Gleap'))
    124131            ->set_page_parent('options-general.php')
     
    130137            ))
    131138            ->add_fields(array(
    132                 Field::make('checkbox', 'gleap_editors_only', 'Enable just for logged in editors')->set_default_value(false)->set_help_text('Widget will only be visible for users with editor or higher role.')
     139                Field::make('checkbox', 'gleap_selected_roles_only', 'Enable Gleap only for the selected WP roles')
     140                    ->set_default_value(false)
     141                    ->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.')
     142            ))
     143            ->add_fields(array(
     144                Field::make('multiselect', 'gleap_selected_roles', 'Select roles')
     145                    ->add_options($roles)
     146                    ->set_conditional_logic(array(
     147                        array(
     148                            'field' => 'gleap_selected_roles_only',
     149                            'value' => true,
     150                            'compare' => '='
     151                        )
     152                    ))
    133153            ));
    134154    }
    135 
     155   
    136156    public function crb_load()
    137157    {
  • gleap/trunk/gleap.php

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

    r2894111 r2936394  
    9494        $gleap_token = carbon_get_theme_option('gleap_token');
    9595        if ($gleap_token) {
    96             $gleap_editors_only = carbon_get_theme_option('gleap_editors_only');
    97             if ($gleap_editors_only == true && !current_user_can('report_feedback')) {
    98                 return;
     96            $gleap_selected_roles_only = carbon_get_theme_option('gleap_selected_roles_only');
     97            if ($gleap_selected_roles_only == true) {
     98                $user_roles = wp_get_current_user()->roles;
     99                $gleap_selected_roles = carbon_get_theme_option('gleap_selected_roles');
     100               
     101                if (!array_intersect($user_roles, $gleap_selected_roles)) {
     102                    // If the user's role is not in the selected roles, don't show Gleap
     103                    return;
     104                }
    99105            }
    100106
    101107            $identify_script = "";
    102108            $gleap_identity_token = carbon_get_theme_option('gleap_identity_token');
    103             if (is_user_logged_in() && $gleap_identity_token) {
     109            if (is_user_logged_in()) {
    104110                $user_data = get_userdata(get_current_user_id());
    105111                $login = $user_data->user_login;
Note: See TracChangeset for help on using the changeset viewer.