discourseconnect의 사용자 정의 필드

사용자를 로그인할 때 사용자 정의 필드를 전달하려고 합니다.

다음은 로그인하는 배열입니다.

$parameters =  array(
            'nonce'       => $nonce,
            'external_id' => 'jay',
            'email'       => 'bugsbunny@betaclub.org',
            'username'    => 'bugsbunny@betaclub.org',
            'name'        => 'Bugs Bunny',n            'add_groups'  => 'state_sponsors',
            'custom.experience' => 'Pro',
           'custom.state' => 'FL',
        );

필드 이름은 Experience이며, 여러 선택 필드(multiselect field)이고 옵션 중 하나가 Pro입니다.
이 값이 넘어오는 것을 확인하지 못하겠습니다. 또한 텍스트 필드인 State라는 이름의 사용자 정의 필드도 있습니다. 어떻게 문제를 해결해야 할까요? discourse connect 로깅을 켜 놓았지만 로그에서 사용자 정의 필드에 대한 내용은 아무것도 찾을 수 없습니다.

관리자 → 사용자 정의 → 사용자 필드를 통해 해당 필드를 생성한 경우, 다음처럼 전달해야 합니다.

$parameters =  array(
            'nonce'       => $nonce,
            'external_id' => 'jay',
            'email'       => 'bugsbunny@betaclub.org',n            'username'    => 'bugsbunny@betaclub.org',n            'name'        => 'Bugs Bunny',n            'add_groups'  => 'state_sponsors',n            'custom.user_field_1' => 'Pro',n            'custom.user_field_2' => 'FL',n        );n```

필드 이름은 UI에서 설정한 이름이 아니라 `user_field_NUMBER` 형식의 번호가 매겨진 필드입니다.

잘 작동했어요. 정말 감사합니다.

멀티 셀렉트 필드에 여러 값을 입력하는 방법을 아시나요?

‘custom.user_field_1’ => ‘Pro, Newbie’,

??

호기심에 지난주에 이 문제를 조사해 봤는데, 현재로서는 DiscourseConnect 페이로드를 통해 멀티 셀렉트 필드를 지원하지 않는 것으로 보입니다.

테스트를 해본 결과, 단일 값만 전송되어도 다중 선택 필드에 값이 채워지는 것을 확인했습니다.
동작하지 않는 경우 - ‘custom.user_field_1’ => ‘Pro, Newbie’,
동작하는 경우 - ‘custom.user_field_1’ => ‘Pro’,

이것은 우리의 요구사항에 부합합니다. 해당 필드가 최종 사용자에게 편집 가능하도록 설정되어 있다면, 사용자는 필요에 따라 다른 선택 항목을 추가할 수 있기 때문입니다.

@Falco 도움 주셔서 정말 감사합니다.

다음 질문은 add_groups에 관한 것입니다. 쉼표로 구분된 목록을 사용하고 있지만, 사용자가 그룹에 추가되지 않습니다.

$parameters =  array(
            'nonce'               => $nonce,
            'external_id'         => $sponsor['spid'],
            'email'               => $sponsor['email'],
            'username'            => $sponsor['email'],
            'name'                => $fullname,
            'add_groups'          => 'state_sponsor, status_sponsor, elect_sponsor',
            'location'            => $location,
            'custom.user_field_1' => $experience, //experience - Newbie, Less than 5, Pro, Old Timer
            'custom.user_field_2' => $club['name'].' ('.$sponsor['new_id'].')',  //school name with clubid
            'custom.user_field_4' => $division, //division
        );

보고된 페이로드는 다음과 같습니다:

add_groups=state_sponsor%2C+status_sponsor%2C+elect_sponsor
email=xxxx%40spart1.org
external_id=xxxx
name=Angela+Moore
nonce=xxxx
username=xxxx%40spart1.org
location=Landrum%2C+SC
custom.user_field_1=Pro
custom.user_field_2=Landrum+Middle+School+%28JSC0081%29
custom.user_field_4=Junior

discourseconnect 로그에서 다음을 확인했습니다:

add_groups: state_sponsor, status_sponsor, elect_sponsor
admin: 
moderator: 
avatar_force_update: 
avatar_url: 
bio: 
card_background_url: 
email: xxxx@spart1.org
external_id: xxxxx
groups: 
locale: 
locale_force_update: 
logout: 
name: Angela Moore
nonce: xxxx
profile_background_url: 
remove_groups: 
require_activation: 
return_sso_url: 
suppress_welcome_message: 
title: 
username: xxxx@spart1.org
website: 
location: Landrum, SC

정상적으로 보입니다.
이 사용자를 ‘state_sponsor, status_sponsor, elect_sponsor’ 그룹에 추가하고 싶습니다.

쉼표 사이에 있는 공백을 제거해야 합니다.