• I would like to use this plugin for other roles not administrators role.

    I added roles fromm [WP Email Users] -> [Setting] -> [Enable Plugin For Other Roles] -> [Select Multiple User Roles] and displayed Changes successfully saved.

    But the role user cannot use this plugin even not access the email sending page.

    It seems like [Select Multiple User Roles] is back to administrators only.

    How do I add other role for use?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi has anyone resolved this?

    Im experiencing the same issues?

    Hi, i’m experiencing the same issue, and tweaked it.

    There are (at least) 2 Bugs:

    a) Enable Plugin For Other Roles doesn’t save anything

    In file wp-autoresponder-email-configure.php there is this code:

    if (isset($_POST['select_multiple_roles'])) {
             $add_custom_role = sanitize_text_field($_POST['select_multiple_roles']);
    }
    if (isset($_POST['save_ar_config'])) {
             update_option('enable_plugin_for_other_roles', $add_custom_role);
    }

    The problem is, that $_POST[‘select_multiple_roles’] always is an array, but sanitize_text_field() only works with a string.

    So $add_custom_role ends up empty, therefore nothing is ever updated.

    My dirty hack looks like:

    if (isset($_POST['select_multiple_roles'])) {
            $custom_roles = $_POST['select_multiple_roles'];
            $add_custom_roles = array();
    
            if (is_array($custom_roles))
            {
                foreach($custom_roles as $custom_role)
                {
                    $add_custom_roles[] = sanitize_text_field($custom_role);
                }
            }
            else
            {
                $add_custom_roles[] = sanitize_text_field($custom_roles);
            }
    }
    if (isset($_POST['save_ar_config']))
    {
      update_option('enable_plugin_for_other_roles', $add_custom_roles);
    }

    Now I can e.g. add the “editor” role, hit save, and it’s save to the wp_option-Table.

    (BTW: the option name “enable_plugin_for_other_roles” should have some plugin name / short name as a prefix, otherwise it’s to generic)

    2. Others than admins can’t access the plugin pages in the admin area

    I added successfully “editor” to the enable_plugin_for_other_roles option, but still got “Sorry, you can’t access the page” when trying to access admin.php?page=weu_send_email (also the menu entries didn’t show up)

    Problem is in wp-email-functions.php, where the menu is created:

    add_menu_page(
      'WP Email Users page',
      'WP Email Users',
      'manage_options',
      'weu-admin-page',
      'tsweu_admin_page',
      'dashicons-email-alt'
    );

    The menu / pages are all created with “manage_options” as required capability.

    I changed it everywhere to this:

    add_menu_page(
      'WP Email Users page',
      'WP Email Users',
      $display_get_user_role,
      'weu-admin-page',
      'tsweu_admin_page',
      'dashicons-email-alt'
    );

    $display_get_user_role holds the allowed user role …

    Hope this helps (the plugin author) to fix the issue!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can’t Enable Plugin For Other Roles’ is closed to new replies.