Plugin Directory

Changeset 3436248


Ignore:
Timestamp:
01/09/2026 07:11:06 PM (3 months ago)
Author:
WebFactory
Message:

Added capability filter

Location:
eps-301-redirects/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • eps-301-redirects/trunk/eps-301-redirects.php

    r3431731 r3436248  
    33Plugin Name: 301 Redirects
    44Description: Easily create and manage redirect rules, and view 404 error log.
    5 Version: 2.82
     5Version: 2.83
    66Author: WebFactory Ltd
    77Author URI: https://www.webfactoryltd.com/
     
    1313License: GPLv2 or later
    1414
    15   Copyright 2015 - 2025  WebFactory Ltd  (email: [email protected])
     15  Copyright 2015 - 2026  WebFactory Ltd  (email: [email protected])
    1616
    1717  This program is free software; you can redistribute it and/or modify
     
    128128  // add widget to dashboard
    129129  function add_widget() {
    130     if (current_user_can('manage_options')) {
     130    if (current_user_can(apply_filters('eps_301_redirects_capability', 'manage_options'))) {
    131131      add_meta_box('wp301_404_errors', '404 Error Log', array($this, 'widget_content'), 'dashboard', 'side', 'high');
    132132    }
     
    637637      check_ajax_referer('eps_301_save_redirect');
    638638
    639       if (!current_user_can('manage_options')) {
     639      if (!current_user_can(apply_filters('eps_301_redirects_capability', 'manage_options'))) {
    640640        wp_die('You are not allowed to run this action.');
    641641      }
     
    859859      check_ajax_referer('eps_301_delete_entry');
    860860
    861       if (!current_user_can('manage_options')) {
     861      if (!current_user_can(apply_filters('eps_301_redirects_capability', 'manage_options'))) {
    862862        wp_die('You are not allowed to run this action.');
    863863      }
     
    915915  check_ajax_referer('eps_301_get_inline_edit_entry');
    916916
    917   if (!current_user_can('manage_options')) {
     917  if (!current_user_can(apply_filters('eps_301_redirects_capability', 'manage_options'))) {
    918918    wp_die('You are not allowed to run this action.');
    919919  }
     
    937937  check_ajax_referer('eps_301_get_entry');
    938938
    939   if (!current_user_can('manage_options')) {
     939  if (!current_user_can(apply_filters('eps_301_redirects_capability', 'manage_options'))) {
    940940    wp_die('You are not allowed to run this action.');
    941941  }
  • eps-301-redirects/trunk/libs/eps-plugin-options.php

    r3246720 r3436248  
    241241    {
    242242      if (in_array($this->plugin->config('menu_location'), $this->menu_locations)) {
    243         $func = sprintf("add_%s_page", $this->plugin->config('menu_location'));
    244         return $func($this->plugin->name, $this->plugin->name, $this->plugin->config('page_permission'), $this->plugin->config('page_slug'), array($this, 'do_admin_page'));
     243        $capability = apply_filters('eps_301_redirects_capability', 'manage_options');       
     244        $location = ($capability == 'manage_options' ? $this->plugin->config('menu_location') : 'menu');
     245        $func = sprintf("add_%s_page", $location);
     246        return $func($this->plugin->name, $this->plugin->name, apply_filters('eps_301_redirects_capability', 'manage_options'), $this->plugin->config('page_slug'), array($this, 'do_admin_page'));
    245247      } else {
    246248        // TODO proper errors dude.
    247         printf('ERROR: menu location "%s" not valid.', esc_attr($this->config['menu_location']));
     249        printf('ERROR: menu location "%s" not valid.', esc_attr($this->plugin->config['menu_location']));
    248250      }
    249251      return false;
  • eps-301-redirects/trunk/plugin.php

    r3391935 r3436248  
    2222    'page_title'        => '301 Redirects',
    2323    'menu_location'     => 'options',
    24     'page_permission'   => 'manage_options',
    2524    'directory'         => 'eps-301-redirects'
    2625  );
     
    250249    $sql = "CREATE TABLE $table_name (
    251250          id mediumint(9) NOT NULL AUTO_INCREMENT,
    252           url_from VARCHAR(256) DEFAULT '' NOT NULL,
    253           url_to VARCHAR(256) DEFAULT '' NOT NULL,
     251          url_from VARCHAR(1024) DEFAULT '' NOT NULL,
     252          url_to VARCHAR(1024) DEFAULT '' NOT NULL,
    254253          status VARCHAR(12) DEFAULT '301' NOT NULL,
    255254          type VARCHAR(12) DEFAULT 'url' NOT NULL,
  • eps-301-redirects/trunk/readme.txt

    r3431731 r3436248  
    44Requires at least: 4.0
    55Tested up to: 6.9
    6 Stable tag: 2.82
     6Stable tag: 2.83
    77Requires PHP: 5.2
    88License: GPLv2 or later
     
    6868
    6969== Changelog ==
     70= 2.83 =
     71* 2026/01/09
     72* increased maximum URL length to 1024 characters
     73* added 'eps_301_redirects_capability' filter to change the capability required to manage redirects. If set to anything other than 'manage_options' 301 Redirects will show under its own menu page instead of under Settings
     74
    7075= 2.82 =
    7176* 2026/01/03
Note: See TracChangeset for help on using the changeset viewer.