XF 2.1 Secondary Group API update

Chipie678

Member
Hi ,

I cant set a secondary group on my guzzle request he return me a 400 bad request

PHP:
XenforoUserAccount::XFSetUserSecondaryGroup($user->xFID,[1,23,12,14]);

public static function XFSetUserSecondaryGroup($xfID,$group){
        $client = new Client([
            'base_uri' => env('XENFORO_URL'),
            'headers' => [
                'XF-Api-Key' => env('XENFORO_EDIT_USER_APIKEY')
            ],
            'content' => "application/x-www-form-urlencoded"
        ]);
        try {
            $client->post("/api/users/$xfID",[
                'form_params' => [
                    'secondary_group_ids ' => $group
                ]
            ]);

        } catch (ClientException $e) {

        }
        return "OK";
    }
 
i got that soluce but i think one are more optimized ?
EtvKm8AZIf.png
 
Back
Top Bottom