Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
5 | public function updateEditForm(&$form) |
||
6 | { |
||
7 | //error_log('Creator id:'.$this->owner->CreatorID); |
||
8 | //error_log('Current member id:'.Member::currentUserID()); |
||
9 | |||
10 | $creatorID = Member::currentUserID(); |
||
11 | $formfields = $form->fields; |
||
12 | $formid = $formfields->fieldbyName('ID'); |
||
13 | //error_log($formid->value()); |
||
14 | $sql = 'select CreatorID from SiteTree where ID='.$formid->value().' Limit 1'; |
||
15 | $result = DB::query($sql); |
||
16 | $first = $result->first(); |
||
17 | $creatorID = $first['CreatorID']; |
||
18 | //error_log('CREATOR: '.$creatorID); |
||
19 | |||
20 | if (!(Permission::check('ADMIN'))) { |
||
21 | if ($creatorID != Member::currentUserID()) { |
||
22 | $form->makeReadonly(); |
||
23 | } |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 |
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.