G gaga Member Jun 30, 2019 #1 Hello i build simple custom add-on but i have a problem In my add-on i need to invite users. I use standard autocomplete but i need from choosed username get just user_id and write to my addon db table Thanks for helping
Hello i build simple custom add-on but i have a problem In my add-on i need to invite users. I use standard autocomplete but i need from choosed username get just user_id and write to my addon db table Thanks for helping
G gaga Member Jul 2, 2019 #3 Ok i have this field: Code: <xf:textboxrow name="u_id" ac="single" placeholder="{{ phrase('username') }}" label="{{ phrase('user_name') }}" /> and this controller: Code: $userRepo = $this->repository('XF:User'); $input = $this->filter([ 'u_id' => 'unum' ]); $recipient = $userRepo->getUserByNameOrEmail($input['u_id']); if (!$recipient) { return $this->notFound(\XF::phrase('requested_user_not_found')); } But not write value in db for u_id
Ok i have this field: Code: <xf:textboxrow name="u_id" ac="single" placeholder="{{ phrase('username') }}" label="{{ phrase('user_name') }}" /> and this controller: Code: $userRepo = $this->repository('XF:User'); $input = $this->filter([ 'u_id' => 'unum' ]); $recipient = $userRepo->getUserByNameOrEmail($input['u_id']); if (!$recipient) { return $this->notFound(\XF::phrase('requested_user_not_found')); } But not write value in db for u_id
G gaga Member Jul 2, 2019 #5 Siropu said: 'u_id' => 'unum' should be 'u_id' => 'str' Click to expand... Code: InvalidArgumentException: Attempted to convert object to integer [u_id]
Siropu said: 'u_id' => 'unum' should be 'u_id' => 'str' Click to expand... Code: InvalidArgumentException: Attempted to convert object to integer [u_id]
K kick Well-known member Jul 2, 2019 #6 'u_id' => 'unum' should be 'u_id' => 'str' HTML: <xf:textboxrow ac="single" placeholder="{{ phrase('username') }}" label="{{ phrase('user_name') }}" name="u_id" /> PHP: $input = $this->filter([ 'u_id' => 'str', ]); /** @var User $userRepo */ $userRepo = $this->repository('XF:User'); $user = $userRepo->getUserByNameOrEmail($input['u_id']); if (!$user) { return $this->error(\XF::phrase('requested_user_not_found')); } Last edited: Jul 2, 2019
'u_id' => 'unum' should be 'u_id' => 'str' HTML: <xf:textboxrow ac="single" placeholder="{{ phrase('username') }}" label="{{ phrase('user_name') }}" name="u_id" /> PHP: $input = $this->filter([ 'u_id' => 'str', ]); /** @var User $userRepo */ $userRepo = $this->repository('XF:User'); $user = $userRepo->getUserByNameOrEmail($input['u_id']); if (!$user) { return $this->error(\XF::phrase('requested_user_not_found')); }
G gaga Member Jul 2, 2019 #7 kick said: 'u_id' => 'unum' should be 'u_id' => 'str' HTML: <xf:textboxrow ac="single" placeholder="{{ phrase('username') }}" label="{{ phrase('user_name') }}" name="u_id" /> PHP: $input = $this->filter([ 'u_id' => 'str', ]); /** @var User $userRepo */ $userRepo = $this->repository('XF:User'); $user = $userRepo->getUserByNameOrEmail($input['u_id']); if (!$user) { return $this->error(\XF::phrase('requested_user_not_found')); } Click to expand... No error but u_id field is just default value 0 no changed.
kick said: 'u_id' => 'unum' should be 'u_id' => 'str' HTML: <xf:textboxrow ac="single" placeholder="{{ phrase('username') }}" label="{{ phrase('user_name') }}" name="u_id" /> PHP: $input = $this->filter([ 'u_id' => 'str', ]); /** @var User $userRepo */ $userRepo = $this->repository('XF:User'); $user = $userRepo->getUserByNameOrEmail($input['u_id']); if (!$user) { return $this->error(\XF::phrase('requested_user_not_found')); } Click to expand... No error but u_id field is just default value 0 no changed.