Airship\Cabin\Bridge\Blueprint\Author::addUserByUniqueId PHP Method

addUserByUniqueId() public method

Add a user, given its unique id.
public addUserByUniqueId ( integer $authorId, string $uniqueId, boolean $inCharge = false ) : boolean
$authorId integer
$uniqueId string
$inCharge boolean
return boolean
    public function addUserByUniqueId(int $authorId, string $uniqueId, bool $inCharge = false) : bool
    {
        $this->db->beginTransaction();
        $userID = (int) $this->db->cell('SELECT userid FROM airship_users WHERE uniqueid = ?', $uniqueId);
        if (empty($userID)) {
            throw new UserFeedbackException(\__('There is no user with this Public ID.'));
        }
        if ($this->userHasAccess($authorId, $userID)) {
            throw new UserFeedbackException(\__('This User already has access to this Author.'));
        }
        $this->db->insert('hull_blog_author_owners', ['authorid' => $authorId, 'userid' => $userID, 'in_charge' => $inCharge]);
        return $this->db->commit();
    }