Plugin Directory

Changeset 2671549


Ignore:
Timestamp:
02/02/2022 05:58:52 PM (4 years ago)
Author:
maurolopes
Message:

Preparing for 1.0.1 release

Location:
unenroll-for-learndash/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • unenroll-for-learndash/trunk/admin/trun-settings.php

    r2586221 r2671549  
    6262        'default' => 'none',
    6363        'description'=> __('Select where to place the \'Unenroll\' button on the grid', 'learndash-unenroll'),
    64         'obs' => '',
     64        'obs' => __('Be aware that the \'Unenroll\' button will be placed on the grid only when the grid shortcode [ld_course_list] is used. If you plan to use the new Course Grid Block feature, the \'Unenroll\' button will not be displayed on the grid, leaving you with the option to show the button on the single course page.', 'learndash-unenroll'),
    6565        'final' => '',
    6666        'order' => 4,
  • unenroll-for-learndash/trunk/assets/js/trun.js

    r2586221 r2671549  
    1414const errorAlertTitle = trun_js_object.errorAlertTitle;
    1515const errorAlertText = trun_js_object.errorAlertText;
     16const errorAlertAdminText = trun_js_object.errorAlertAdminText;
    1617const alertReloadButton = trun_js_object.alertReloadButton;
    1718const cancelAlertTextGroup = trun_js_object.cancelAlertTextGroup;
     
    107108                                responseText = errorAlertText;
    108109                                responseType = 'warning';
     110                                //check if response has 'admin' substring in it
     111                                if(response.indexOf('admin') > -1) {
     112                                    responseText = errorAlertAdminText;
     113                                }
    109114                            }
    110115                            console.log(response);
  • unenroll-for-learndash/trunk/includes/functions.php

    r2586221 r2671549  
    3939    }
    4040   
    41     $user_id = get_current_user_id();
     41    //get current user
     42    $user = wp_get_current_user();
     43    $user_id = $user->ID;
     44     //check if has admin role
     45    $admin_roles = array(
     46        'administrator'
     47    );
     48    $has_admin_role = array_intersect($admin_roles, $user->roles );
     49
     50    if($has_admin_role) {
     51        wp_die('Error: admin');
     52    }
    4253   
    4354    $user_groups = ( !empty($_POST['userGroups']) && is_array($_POST['userGroups']) ) ? (array)$_POST['userGroups'] : [];
     
    4960    }
    5061
    51     //User still has access. Course must be part of a group
     62    //User still has access. Course must be admin or part of a group
    5263    if(empty($user_groups)) {
    5364        //very strange...that should not happen
  • unenroll-for-learndash/trunk/learndash-unenroll.php

    r2586221 r2671549  
    66 * Author: Luis Rock
    77 * Author URI: https://wptrat.com/
    8  * Version: 1.0.0
     8 * Version: 1.0.1
    99 * Text Domain: learndash-unenroll
    1010 * Domain Path: /languages
     
    8181            /* translators: Text for the (maybe) error alert box */
    8282            'errorAlertText' => esc_html__( 'We could not check the result.', 'learndash-unenroll' ),
     83            /* translators: Text for when an admin is trying to enroll from a course (which is impossible) */
     84            'errorAlertAdminText' => esc_html__( 'You are a site admin, so you cannot unenroll.', 'learndash-unenroll' ),
    8385            /* translators: Text for the alert box reload button */
    8486            'alertReloadButton' => esc_html__( 'Reload', 'learndash-unenroll' ),
  • unenroll-for-learndash/trunk/readme.txt

    r2586221 r2671549  
    55Tested up to: 5.8
    66Requires PHP: 5.6
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GNU General Public License v3.0
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5252
    5353== Changelog ==
     54= 1.0.1 =
     55* Added: alert that site admin user cannot unenroll
     56* Added: inform on the settings page that the 'Unenroll' button will be placed on the grid only when the grid shortcode [ld_course_list] is used (no support for the new Course Grid Block feature).
     57
    5458= 1.0.0 =
    5559* Initial Release.
Note: See TracChangeset for help on using the changeset viewer.