These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Overwrite group object so we can setup some more default groups |
||
5 | */ |
||
6 | class Ext_Users_Group extends DataExtension |
||
0 ignored issues
–
show
|
|||
7 | { |
||
8 | public function requireDefaultRecords() |
||
9 | { |
||
10 | parent::requireDefaultRecords(); |
||
11 | |||
12 | // Add default author group if no other group exists |
||
13 | $frontend_group = Group::get()->filter("Code", "users-frontend"); |
||
14 | |||
15 | View Code Duplication | if (!$frontend_group->exists()) { |
|
16 | $frontend_group = new Group(); |
||
17 | $frontend_group->Code = 'users-frontend'; |
||
18 | $frontend_group->Title = "Frontend Users"; |
||
19 | $frontend_group->Sort = 1; |
||
20 | $frontend_group->write(); |
||
21 | Permission::grant($frontend_group->ID, 'USERS_MANAGE_ACCOUNT'); |
||
22 | |||
23 | DB::alteration_message('Front end users group created', 'created'); |
||
24 | } |
||
25 | |||
26 | // Add a verified users group (only used if we turn on |
||
27 | // verification) |
||
28 | $verify_group = Group::get()->filter("Code", "users-verified"); |
||
29 | |||
30 | View Code Duplication | if (!$verify_group->exists()) { |
|
31 | $verify_group = new Group(); |
||
32 | $verify_group->Code = 'users-verified'; |
||
33 | $verify_group->Title = "Verified Users"; |
||
34 | $verify_group->Sort = 1; |
||
35 | $verify_group->write(); |
||
36 | Permission::grant($verify_group->ID, 'USERS_VERIFIED'); |
||
37 | |||
38 | DB::alteration_message('Verified users group created', 'created'); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.