Plugin Directory

Changeset 2692638


Ignore:
Timestamp:
03/11/2022 03:03:10 PM (4 years ago)
Author:
ClearcodeHQ
Message:

Version 1.1.0

Location:
cc-god-user
Files:
48 added
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • cc-god-user/trunk/README.txt

    r1925743 r2692638  
    44Requires PHP: 7.0
    55Requires at least: 4.9.8
    6 Tested up to: 4.9.8
     6Tested up to: 5.9.1
    77Stable tag: trunk
    88License: GPLv3
     
    4545== Changelog ==
    4646
     47= 1.1.0 =
     48* Release date: 11.03.2022*
     49
     50* Fixed Multisite support.
     51
    4752= 1.0.0 =
     53* Release date: 16.08.2018*
    4854
    4955* First stable version of the plugin.
  • cc-god-user/trunk/includes/God_User.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc> and associates
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc> and associates
    55    (see AUTHORS.txt file).
    66
     
    2424namespace Clearcode;
    2525
    26 use Clearcode\Framework\v3\Plugin;
     26use Clearcode\God_User\Vendor\Clearcode\Framework\v3\Plugin;
    2727use Clearcode\God_User\Table;
    2828use Clearcode\God_User\Profile;
     
    6363
    6464        static public function is_god() {
    65             return ( current_user_can( self::ROLE ) && current_user_can( self::CAPABILITY ) );
     65            if ( ! $current_user = wp_get_current_user() ) return false;
     66            return ( isset( $current_user->caps[ self::ROLE ] ) && isset( $current_user->caps[ self::CAPABILITY ] ) );
    6667        }
    6768
  • cc-god-user/trunk/includes/Profile.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc> and associates
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc> and associates
    55    (see AUTHORS.txt file).
    66
     
    2323
    2424namespace Clearcode\God_User;
     25use Clearcode\God_User;
    2526
    26 use Clearcode\God_User;
    27 use Clearcode\Framework\v3\Singleton;
    28 use Clearcode\Framework\v3\Filterer;
     27use Clearcode\God_User\Vendor\Clearcode\Framework\v3\Singleton;
     28use Clearcode\God_User\Vendor\Clearcode\Framework\v3\Filterer;
    2929use WP_User;
    3030
     
    3939
    4040        public function action_edit_user_profile( $user ) {
    41             if ( God_User::is_god() && $user->has_cap( God_User::ROLE ) )
     41            if ( God_User::is_god() && isset( $user->caps[ God_User::ROLE ] ) )
    4242                echo God_User::render( 'profile', [
    4343                    'title'       => God_User::__( 'God User' ),
     
    4545                        'content' => God_User::__( 'God User' )
    4646                    ] ) ),
    47                     'checked'     => checked( $user->has_cap( God_User::CAPABILITY ), true, false ),
     47                    'checked'     => checked( isset( $user->caps[ God_User::CAPABILITY ] ), true, false ),
    4848                    'id'          => God_User::CAPABILITY,
    4949                    'name'        => God_User::CAPABILITY
     
    5353        public function action_profile_update( $user_id ) {
    5454            if ( ! $user = new WP_User( $user_id ) )  return;
    55             if ( ! $user->has_cap( God_User::ROLE ) ) return;
     55            if ( ! isset( $user->caps[ God_User::ROLE ] ) ) return;
    5656            if ( God_User::is_god() )
    57                 isset( $_POST[ God_User::CAPABILITY ] ) ? $user->add_cap( God_User::CAPABILITY ) : $user->remove_cap( God_User::CAPABILITY );
     57                isset( $_POST[ God_User::CAPABILITY ] )
     58                    ? $user->add_cap( God_User::CAPABILITY )
     59                    : $user->remove_cap( God_User::CAPABILITY );
    5860        }
    5961
    6062        public function action_edit_user_profile_update( $user_id ) {
    61             if ( ! $user = new WP_User( $user_id ) )  return;
    62             if ( $user->has_cap( God_User::CAPABILITY ) && ! God_User::is_god() )
     63            if ( ! $user = new WP_User( $user_id ) ) return;
     64            if ( isset( $user->caps[ God_User::CAPABILITY ] ) && ! God_User::is_god() )
    6365                wp_die( God_User::__( 'Cheatin&#8217; uh?' ) );
    6466        }
  • cc-god-user/trunk/includes/Table.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc> and associates
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc> and associates
    55    (see AUTHORS.txt file).
    66
     
    2323
    2424namespace Clearcode\God_User;
     25use Clearcode\God_User;
    2526
    26 use Clearcode\God_User;
    27 use Clearcode\Framework\v3\Singleton;
    28 use Clearcode\Framework\v3\Filterer;
     27use Clearcode\God_User\Vendor\Clearcode\Framework\v3\Singleton;
     28use Clearcode\God_User\Vendor\Clearcode\Framework\v3\Filterer;
    2929
    3030if ( ! defined( 'ABSPATH' ) ) exit;
     
    6262
    6363        public function filter_get_role_list( $role, $user ) {
    64             if ( array_key_exists( God_User::ROLE, $role ) and $user->has_cap( God_User::CAPABILITY ) )
     64            if ( array_key_exists( God_User::ROLE, $role ) and isset( $user->caps[ God_User::CAPABILITY ] ) )
    6565                $role[ God_User::ROLE ] = God_User::__( 'God User' );
    6666            return $role;
  • cc-god-user/trunk/plugin.php

    r1925743 r2692638  
    77 * @author      Nikodem Jankiewicz <http://nikodemjankiewicz.pl>
    88 * @author      PiotrPress <http://piotr.press>
    9  * @copyright   2018 Clearcode
     9 * @copyright   2022 Clearcode
    1010 * @license     GPL-3.0+
    1111 *
     
    1414 * Plugin URI:  https://wordpress.org/plugins/cc-god-user
    1515 * Description: This plugin allows to add the God Users capability, block the delete option and hide specific users on the users list.
    16  * Version:     1.0.0
     16 * Version:     1.1.0
    1717 * Author:      Clearcode
    1818 * Author URI:  https://clearcode.cc
     
    2222 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
    2323
    24     Copyright (C) 2018 by Clearcode <https://clearcode.cc> and associates
     24    Copyright (C) 2022 by Clearcode <https://clearcode.cc> and associates
    2525    (see AUTHORS.txt file).
    2626
     
    4343
    4444namespace Clearcode\God_User;
    45 
    4645use Clearcode\God_User;
    47 use Clearcode\Framework\v3\Autoloader;
    4846
    4947defined( 'ABSPATH' ) or exit;
    5048
    5149try {
    52     require __DIR__ . '/vendor/autoload.php';
    53     new Autoloader( [ __NAMESPACE__  . '\\' => __DIR__ . '/includes' ] );
    54 
    55     foreach( [ 'God_User' ] as $file )
    56         require_once( __DIR__ . "/includes/$file.php" );
    57 
     50    require __DIR__ . '/vendor/autoload.php';
    5851    God_User::instance( __FILE__ );
    59 
    6052} catch ( Exception $exception ) {
    6153    if ( WP_DEBUG && WP_DEBUG_DISPLAY )
  • cc-god-user/trunk/uninstall.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc> and associates
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc> and associates
    55    (see AUTHORS.txt file).
    66
  • cc-god-user/trunk/vendor/autoload.php

    r1925743 r2692638  
    1 <?php
    2 
    3 // autoload.php @generated by Composer
    4 
    5 require_once __DIR__ . '/composer/autoload_real.php';
    6 
    7 return ComposerAutoloaderInitcd6612990B4EBF424413DFEFB23EB54745::getLoader();
     1<?php return spl_autoload_register( function( string $class ) {
     2    $map = require __DIR__ . '/classmap.php';
     3    if ( isset( $map[ $class ] ) ) require dirname( __DIR__ ) . $map[ $class ];
     4} );
  • cc-god-user/trunk/vendor/clearcode/wordpress-framework/src/v3/Filterer.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc>
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc>
    55    and associates (see AUTHORS.txt file).
    66
     
    2222 */
    2323
    24 namespace Clearcode\Framework\v3;
     24namespace Clearcode\God_User\Vendor\Clearcode\Framework\v3;
    2525
    2626use ReflectionClass;
  • cc-god-user/trunk/vendor/clearcode/wordpress-framework/src/v3/Plugin.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc>
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc>
    55    and associates (see AUTHORS.txt file).
    66
     
    2222 */
    2323
    24 namespace Clearcode\Framework\v3;
     24namespace Clearcode\God_User\Vendor\Clearcode\Framework\v3;
    2525
    2626defined( 'ABSPATH' ) or exit;
  • cc-god-user/trunk/vendor/clearcode/wordpress-framework/src/v3/Singleton.php

    r1925743 r2692638  
    22
    33/*
    4     Copyright (C) 2018 by Clearcode <https://clearcode.cc>
     4    Copyright (C) 2022 by Clearcode <https://clearcode.cc>
    55    and associates (see AUTHORS.txt file).
    66
     
    2222 */
    2323
    24 namespace Clearcode\Framework\v3;
     24namespace Clearcode\God_User\Vendor\Clearcode\Framework\v3;
    2525
    2626defined( 'ABSPATH' ) or exit;
     
    2828if ( ! trait_exists( __NAMESPACE__ . '\Singleton' ) ) {
    2929    trait Singleton {
    30         final private function __clone() {
    31             _doing_it_wrong( __METHOD__, __( 'Cheatin&#8217; uh?' ), '' );
    32         }
    33         final private function __wakeup() {
    34             _doing_it_wrong( __METHOD__, __( 'Cheatin&#8217; uh?' ), '' );
    35         }
    36        
    3730        protected function __construct() {
    3831            _doing_it_wrong( __METHOD__, __( 'Cheatin&#8217; uh?' ), '' );
Note: See TracChangeset for help on using the changeset viewer.