Plugin Directory

Changeset 2541113


Ignore:
Timestamp:
06/02/2021 08:53:05 AM (5 years ago)
Author:
GuyPrimavera
Message:

Bugfix for plugin deactivation hook

Location:
editor-menu-and-widget-access
Files:
34 added
5 edited

Legend:

Unmodified
Added
Removed
  • editor-menu-and-widget-access/trunk/README.md

    r2540064 r2541113  
    33* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YVPWSJB4SPN5N
    44
    5 Allow and control Editors' access to the Menus, Widgets and Customize areas of the Appearance menu. You can also hide custom theme options.
    6 
     5Allow and control Editor and Shop Manager access to the menus, widgets and appearance menu, plus other menus and adminbar items.
    76## Description
    87
  • editor-menu-and-widget-access/trunk/admin/caps.php

    r2540064 r2541113  
    11<?php if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }
    2 
    3 function emwa_reset_caps() {
    4   get_role('editor') -> remove_cap('edit_theme_options');
    5   get_role('shop_manager') -> remove_cap('edit_theme_options');
    6 }
    7 register_deactivation_hook(__FILE__, 'emwa_reset_caps');
    82
    93// Remove access to Themes page.
     
    3529    $shopMan = get_role('shop_manager');
    3630    $editor -> add_cap('edit_theme_options');
     31   
    3732    if (!empty($shopMan)) {
    3833      $shopMan -> add_cap('edit_theme_options');
  • editor-menu-and-widget-access/trunk/editor-menu-widget-access.php

    r2540064 r2541113  
    33 * Plugin Name: Editor Menu and Widget Access
    44 * Plugin URI: https://wordpress.org/plugins/editor-menu-and-widget-access/
    5  * Description: Allow and control Editors' access to the Menus, Widgets and Customize areas of the Appearance menu. You can also hide custom theme options.
     5 * Description: Allow and control Editor and Shop Manager access to the menus, widgets and appearance menu, plus other menus and adminbar items.
    66 * Author: Guy Primavera
    77 * Author URI: https://guyprimavera.com/
    8  * Version: 3.1.1
     8 * Version: 3.1.2
     9 * WC requires at least: 3.0.0
     10 * WC tested up to: 5.3
    911 * Text Domain: editor-menu-and-widget-access
    1012 * Domain Path: /lang
     
    1416
    1517if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { exit; }
     18
     19define( 'EMWA_PLUGIN_FILE', basename( __FILE__ ) );
     20define( 'EMWA_PLUGIN_FULL_PATH', __FILE__ );
    1621
    1722include('admin/caps.php');
     
    2328// Plugin action links
    2429add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'emwa_action_links');
     30add_filter('plugin_row_meta', 'emwa_row_meta', 10, 2);   
    2531
    2632/// i18n
     
    3137}
    3238add_action('plugins_loaded', 'emwa_i18n_setup');
     39
     40function emwa_deactivate() {
     41  $editor = get_role('editor');
     42
     43  if (!empty($editor)) {
     44    $editor -> remove_cap('edit_theme_options');
     45  }
     46}
     47register_deactivation_hook(__FILE__, 'emwa_deactivate');
  • editor-menu-and-widget-access/trunk/options/registerSettings.php

    r2539694 r2541113  
    126126function emwa_action_links($links) {
    127127  $emwa_links[] = '<a href="' . esc_url(get_admin_url(null, 'themes.php?page=editorMenuWidgetAccess')) . '">' . __('Settings', 'editor-menu-and-widget-access') . '</a>';
     128
    128129  return array_merge($emwa_links, $links);
    129130}
     131
     132function emwa_row_meta($links, $file) {
     133  if ($file == plugin_basename(dirname(EMWA_PLUGIN_FULL_PATH) .'/'.EMWA_PLUGIN_FILE)) {
     134    $links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YVPWSJB4SPN5N" target="_blank">' . __('Donate', 'editor-menu-and-widget-access') . '</a>';
     135    $links[] = '<a href="https://wordpress.org/plugins/editor-menu-and-widget-access/#developers" target="_blank">' . __('Changelog', 'editor-menu-and-widget-access') . '</a>';
     136  }
     137
     138  return $links;
     139}
  • editor-menu-and-widget-access/trunk/readme.txt

    r2540064 r2541113  
    55Requires at least: 3.0.1
    66Tested up to: 5.7
    7 Stable tag: 3.1.1
     7Stable tag: 3.1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Allow and control Editors' access to the WordPress Appearance menu, and hide other menus and admin bar items.
     11Allow and control Editor and Shop Manager access to the menus, widgets and appearance menu, plus other menus and adminbar items.
    1212
    1313== Description ==
     
    1919This plugin also gives access to the **Customize** submenu and other theme options, but these can be hidden through the options page at **Appearance > Editor Access** if you wish.
    2020
    21 You can now select other menus to hide from Editors and Shop Managers (e.g. Custom theme or plugin options pages), as well as hiding **any elements on the Admin Bar**.
     21You can also select other menus to hide from Editors and Shop Managers (e.g. custom theme or plugin options pages), as well as hiding **any elements on the Admin Bar**.
    2222
    2323**Features**
     
    6363
    6464== Changelog ==
     65
     66= 3.1.2 =
     67* Capabilities now reset on plugin deactivation.
    6568
    6669= 3.1.1 =
     
    134137== Upgrade Notice ==
    135138
     139= 3.1.2 =
     140* Capabilities now reset on plugin deactivation.
     141
    136142= 3.1.1 =
    137143* Bug fixed for WooCommerce shop_manager role.
Note: See TracChangeset for help on using the changeset viewer.