mirror of
https://github.com/processwire/processwire.git
synced 2025-08-16 03:34:33 +02:00
Fix issue processwire/processwire-issues#1292
This commit is contained in:
@@ -2057,7 +2057,7 @@ class Page extends WireData implements \Countable, WireMatchable {
|
|||||||
} else if($userType === 'modified' || strpos($userType, 'modified') === 0) {
|
} else if($userType === 'modified' || strpos($userType, 'modified') === 0) {
|
||||||
$userType = 'modified';
|
$userType = 'modified';
|
||||||
} else {
|
} else {
|
||||||
return new NullPage();
|
return $this->wire(new NullPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$property = '_' . $userType . 'User';
|
$property = '_' . $userType . 'User';
|
||||||
@@ -2068,16 +2068,20 @@ class Page extends WireData implements \Countable, WireMatchable {
|
|||||||
|
|
||||||
$key = $userType . '_users_id';
|
$key = $userType . '_users_id';
|
||||||
$uid = (int) $this->settings[$key];
|
$uid = (int) $this->settings[$key];
|
||||||
if(!$uid) return new NullPage();
|
if(!$uid) return $this->wire(new NullPage());
|
||||||
|
|
||||||
if($uid === (int) $this->wire('user')->id) {
|
$u = $this->wire()->user;
|
||||||
|
if($u && $uid === $u->id) {
|
||||||
// ok use current user $user
|
// ok use current user $user
|
||||||
$user = $this->wire('user');
|
$user = $u;
|
||||||
} else {
|
} else {
|
||||||
// get user
|
// get user
|
||||||
$user = $this->wire('users')->get($uid);
|
$users = $this->wire()->users;
|
||||||
|
if($users) $user = $users->get($uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$user) $user = $this->wire(new NullPage());
|
||||||
|
|
||||||
$this->$property = $user; // cache to _createdUser or _modifiedUser
|
$this->$property = $user; // cache to _createdUser or _modifiedUser
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
Reference in New Issue
Block a user