-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPlugin.php
More file actions
90 lines (78 loc) · 2.67 KB
/
Plugin.php
File metadata and controls
90 lines (78 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php namespace Uxms\Userverify;
use Event;
use Backend;
use Redirect;
use System\Classes\PluginBase;
use System\Classes\SettingsManager;
use Illuminate\Foundation\AliasLoader;
use RainLab\User\Models\User;
use Uxms\Userverify\Models\Configs;
class Plugin extends PluginBase
{
public $require = ['RainLab.User', 'RainLab.UserPlus'];
public function pluginDetails()
{
return [
'name' => 'uxms.userverify::lang.app.name',
'description' => 'uxms.userverify::lang.app.desc',
'author' => 'uXMs Devs',
'icon' => 'icon-check-square-o',
'homepage' => 'https://uxms.net'
];
}
public function registerPermissions()
{
return [
'uxms.userverify.settings' => ['tab' => 'Access API Settings', 'label' => 'Verify with Call'],
];
}
public function registerSettings()
{
return [
'config' => [
'label' => 'uxms.userverify::lang.app.name',
'description' => 'uxms.userverify::lang.app.setting_desc',
'icon' => 'icon-check-square-o',
'class' => 'Uxms\Userverify\Models\Configs',
'order' => 998,
'category' => SettingsManager::CATEGORY_USERS,
'permissions' => ['uxms.userverify.settings']
]
];
}
public function registerComponents()
{
return [
'Uxms\Userverify\Components\CheckIfVerified' => 'CheckIfVerified',
'Uxms\Userverify\Components\VerifyForm' => 'VerifyForm'
];
}
/**
* The boot() method is called right before a request is routed
*/
public function boot()
{
if (Configs::get('activated') == null)
Configs::set('activated', '0');
Event::listen('backend.form.extendFields', function($widget)
{
if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) return;
if (!$widget->model instanceof \RainLab\User\Models\User) return;
$widget->addFields([
'userverify_dateverified' => [
'label' => 'Verified Date',
'tab' => 'Verification',
'type' => 'datepicker',
'default' => '0000:00:00 00:00:00'
]
], 'primary');
$widget->addFields([
'userverify_callerphone' => [
'label' => 'Caller Phone (System)',
'tab' => 'Verification',
'type' => 'text'
]
], 'primary');
});
}
}