# 사용자 프로필 카드에 사용자 지정 버튼을 추가하는 방법?

**URL:** https://meta.discourse.org/t/how-to-add-a-custom-button-in-user-profile-card/300826
**Category:** Development
**Created:** [3월 25, 2024, 1:13오후 UTC](https://meta.discourse.org/t/how-to-add-a-custom-button-in-user-profile-card/300826 "2024-03-25T13:13:46Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [3월 25, 2024, 3:03오후 UTC](https://meta.discourse.org/t/how-to-add-a-custom-button-in-user-profile-card/300826/4 "2024-03-25T15:03:46Z")

</div>

[Using Plugin Outlet Connectors from a Theme or Plugin](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727) 를 읽어보시길 권장합니다. 질문에 대한 답을 찾으실 수 있을 것입니다!

기본적으로 플러그인 아웃렛(plugin outlet)은 특정 위치에 코드를 주입하는 방법입니다.

[테마 CLI](https://meta.discourse.org/t/install-the-discourse-theme-cli-console-app-to-help-you-build-themes/82950)를 사용하여 테마 구성 요소를 생성하고, 제가 내 테마 구성 요소에서 한 것처럼 [별도의 파일](https://meta.discourse.org/t/split-up-theme-javascript-into-multiple-files/119369)을 사용하는 것이 좋습니다 (테스트/수정할 수 있도록 제 저장소를 클론하는 것을 주저하지 마세요):

> <https://github.com/Arkshine/discourse-chat-button-in-profile/blob/main/javascripts/discourse/connectors/user-profile-controls/chat-button.hbs>

하지만 여전히 `<script>` 태그에서 테스트할 수 있습니다:

> [@Discourse](#):
>
> ℹ 테마를 통한 템플릿 정의
> 
> 커넥터 템플릿에는 전용 파일 사용을 권장합니다. 그러나 Discourse는 여전히 테마의 `</head>` 섹션에서 `<script>` 태그를 사용하여 템플릿을 정의하는 방식을 지원합니다. 이 경우 정의는 다음과 같이 보입니다.
> 
> ```plaintext
> <script type='text/x-handlebars' data-template-name='/connectors/{outlet-name}/{connector-name}'>
> Template content here
> </script>
> 
> ```

귀하의 경우, 다음과 같이 작성해야 합니다:

```js
<script type='text/x-handlebars' data-template-name='/connectors/user-profile-controls/my_connector_name'>
  Template content here
</script>

```

첫 번째 줄에 주목하세요. 커넥터 이름으로 `user-profile-controls`를 사용하고, `my_connector_name`은 원하는 대로 지정할 수 있습니다.

---

_[View the full topic](https://meta.discourse.org/t/how-to-add-a-custom-button-in-user-profile-card/300826)._
