PHP code example of derekashauer / support-access-manager

1. Go to this page and download the library: Download derekashauer/support-access-manager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

derekashauer / support-access-manager example snippets






// Get the instance with default settings
Support_Access_Manager::instance();

// Or get the instance with custom settings
Support_Access_Manager::instance( array(
    'menu_label' => 'Support Users',
    'menu_slug'  => 'support-users',
    'textdomain' => 'my-plugin',
    'defaults'   => array(
        'duration'      => 2,
        'duration_unit' => 'days',
        'role'          => 'editor',
    ),
) );

class My_Custom_Support_Access extends Support_Access_Manager {
    // Override the singleton functionality
    public static function instance( $args = array() ) {
        return new self( $args );
    }

    // Make constructor public
    public function __construct( $args = array() ) {
        parent::__construct( $args );
    }
}

// Create your custom instance
$my_support = My_Custom_Support_Access::instance( array(
    'menu_slug'   => 'my-custom-support',
    'menu_label'  => 'My Custom Support',
    'parent_slug' => 'tools.php',
    'textdomain'  => 'my-plugin',
) );

new Support_Access_Manager( array(
    'menu_label' => 'Contractor Access',
    'defaults'   => array(
        'duration'      => 1,
        'duration_unit' => 'months',
        'role'          => 'author',
    ),
) );

new Support_Access_Manager( array(
    'defaults' => array(
        'timeout'       => 48,
        'usage_limit'   => 5,
        'role'          => 'editor',
        'locale'        => 'es_ES',
    ),
) );

new Support_Access_Manager( array(
    'textdomain' => 'my-plugin',
) );