Initial commit
This commit is contained in:
75
app/plugins/members/plugin.php
Normal file
75
app/plugins/members/plugin.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/chat/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP Chat
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Plugins;
|
||||
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
use TheTempusProject\Classes\Plugin;
|
||||
|
||||
class Members extends Plugin {
|
||||
public $pluginName = 'TP Membership';
|
||||
public $configName = 'membership';
|
||||
public $pluginAuthor = 'JoeyK';
|
||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||
public $modelVersion = '1.0';
|
||||
public $pluginVersion = '3.0';
|
||||
public $pluginDescription = 'A simple plugin which adds a site wide membership system.';
|
||||
public $permissionMatrix = [
|
||||
'memberAccess' => [
|
||||
'pretty' => 'Access Member Areas',
|
||||
'default' => false,
|
||||
],
|
||||
'controlMemberships' => [
|
||||
'pretty' => 'User can Access and Control user memberships.',
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-lock"></i> Memberships',
|
||||
'url' => '{ROOT_URL}admin/member',
|
||||
],
|
||||
];
|
||||
public $main_links = [
|
||||
[
|
||||
'text' => 'Members',
|
||||
'url' => '{ROOT_URL}member/index',
|
||||
'filter' => 'member',
|
||||
],
|
||||
];
|
||||
public $resourceMatrix = [
|
||||
'groups' => [
|
||||
[
|
||||
'name' => 'Member',
|
||||
'permissions' => '{"adminAccess":false}',
|
||||
]
|
||||
],
|
||||
];
|
||||
public function __construct( $load = false ) {
|
||||
if ( App::$isLoggedIn ) {
|
||||
App::$isMember = $this->hasMemberAccess( App::$activeGroup );
|
||||
if ( empty( App::$isMember ) ) {
|
||||
App::$isMember = $this->hasMemberAccess( App::$activeUser );
|
||||
}
|
||||
}
|
||||
$this->filters[] = [
|
||||
'name' => 'member',
|
||||
'find' => '#{MEMBER}(.*?){/MEMBER}#is',
|
||||
'replace' => ( App::$isMember ? '$1' : '' ),
|
||||
'enabled' => true,
|
||||
];
|
||||
parent::__construct( $load );
|
||||
}
|
||||
public function hasMemberAccess( $input ) {
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user