diff --git a/include/class-DomainAPI.php b/include/class-DomainAPI.php index 5e51ece..ad39a72 100644 --- a/include/class-DomainAPI.php +++ b/include/class-DomainAPI.php @@ -1,69 +1,70 @@ . /** * Domain API */ class DomainAPI extends Query { public function __construct() { parent::__construct(); $this->from( Domain::T ); $this->defaultClass( 'Domain' ); } /** * Join domain and users (once) * * @return self */ public function joinDomainUser() { if( empty( $this->joinedDomainUser ) ) { $this->from( 'domain_user' ); $this->equals( 'domain_user.domain_ID', 'domain.domain_ID' ); + $this->joinedDomainUser = true; } return $this; } /** * Where the domains are editable by me * * @return self */ public function whereDomainIsEditable() { if( ! has_permission( 'edit-domain-all' ) ) { $this->whereDomainUser(); } return $this; } /** * Limit to a certain user (or yourself) * * @param $user_ID int * @return self */ public function whereDomainUser( $user_ID = false ) { - if( ! $user_ID ) { + if( $user_ID === false ) { $user_ID = get_user( 'user_ID' ); } $this->joinDomainUser(); return $this->whereInt( 'domain_user.user_ID', $user_ID ); } }