# (Retired) Use an ID in a custom user field to link to a user's external profile

**URL:** https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218
**Category:** Site Management
**Created:** [3월 17, 2016, 5:43오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218 "2016-03-17T17:43:28Z")
**Posts on this page:** 15
**Page:** 3

<div class="post-metadata">

### Author: ![Denis\_Heraud](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denis_heraud/32/119623_2.png) [@Denis\_Heraud](https://meta.discourse.org/u/Denis_Heraud)
#### Post date: [8월 3, 2018, 2:19오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/49 "2018-08-03T14:19:15Z")

</div>

Also today I realized that the User Profile page actually displays the custom field as it should, although compared to the user card, now the custom field (Website) is displayed last instead of first..

 ![Capture](https://global.discourse-cdn.com/meta/original/3X/a/9/a90c929f6a5307f140a0012fd83762e8bb31208b.PNG)

---

<div class="post-metadata">

### Author: ![jtbayly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jtbayly/32/119510_2.png) [@jtbayly](https://meta.discourse.org/u/jtbayly)
#### Post date: [12월 26, 2018, 2:14오전 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/50 "2018-12-26T02:14:18Z")

</div>

I feel like I’ve seen a discussion of this, but I can’t find it now.

I’ve got a custom profile field that holds a user’s website implemented using this tutorial, but allowing for any external site to be entered, rather than just linking to Twitter or something. The problem I have is that about 80% of the users don’t bother to put “http(s)://” in front of the URL they enter. They (rightly) expect that “[www.example.com](http://www.example.com)” should just work. So how do I make it just work?

Edited to add: Figured it out. Below is the entire if block of javascript I used to determine whether to attempt to show an external link. The inner if is what determines whether the external URL needs to have “http” added to it, and takes care of doing it.

```
    if (userFields && userFields[churchURLFieldId]) {
      const rawChurchURL = userFields[churchURLFieldId];
      var url = rawChurchURL;
      if (!/^https?:\/\//i.test(rawChurchURL)) {
        url = 'http://' + rawChurchURL;
      }
      const link = "<a href='"+url+"' target='_blank'>"+userFields[churchNameFieldId];+"</a>";
      return Ember.Object.create({ link, name: churchURL.get('name') });
    } else {
      return null;
    }

```

---

<div class="post-metadata">

### Author: ![harshvchawla](https://avatars.discourse-cdn.com/v4/letter/h/c4cdca/32.png) [@harshvchawla](https://meta.discourse.org/u/harshvchawla)
#### Post date: [10월 12, 2019, 9:39오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/51 "2019-10-12T21:39:09Z")

</div>

**기존 사용자 프로필 필드를 새 필드를 추가하는 대신 편집할 방법이 있을까요?** 기존 트위터 필드 값을 편집하여 앵커 태그를 포함하도록 하려는 목적입니다.

새로운 클릭 가능한 프로필 필드를 커넥터/핸들바 아웃렛 등을 사용하여 추가할 수 있도록 하는 메인 게시글에 따르면, 해당 필드들이 "추가"되므로 기존 프로필 필드를 숨겨야 했습니다.  
예를 들어, 클릭 가능한 트위터 필드를 추가할 수 있지만, 그러면 기존 트위터 필드를 숨겨야 합니다.  
이렇게 새로 추가된 트위터 필드는 기존에 존재하던 그 에임버(ember) div에 속하는 것이 아니라 별도의 div에 위치하게 되어, 이상한 CSS 문제가 발생합니다.

여기서 `/connectors/user-profile-primary/` 대신 `/connectors/user-profile-public-fields/Twitter`를 사용하는 것이 도움이 될까요?

---

<div class="post-metadata">

### Author: ![weallwegot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/weallwegot/32/124753_2.png) [@weallwegot](https://meta.discourse.org/u/weallwegot)
#### Post date: [7월 18, 2020, 4:28오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/52 "2020-07-18T16:28:52Z")

</div>

정말 좋네요. 포크해서 Namati에 특화된 부분을 빼고, 좀 더 범용적인 테마 컴포넌트로 만들려고 시도해 봤습니다. 괜찮으시죠!

> **[GitHub - weallwegot/discourse-social-links-clickable: make social links clickable](https://github.com/weallwegot/discourse-social-links-clickable)**
>
> make social links clickable

다른 분들이 찾기 쉽게 하려고 별도의 포스트도 올렸어요:

> [@프로필에서 클릭 가능한 소셜 아이콘 링크](https://meta.discourse.org/t/theme-component-clickable-social-icon-links-on-profile/158136):
>
> 사용자 프로필 및 사용자 카드에서 소셜 아이콘을 클릭할 수 있도록 포함하는 테마 컴포넌트입니다. [사용자 카드 디렉터리 테마 컴포넌트](https://meta.discourse.org/t/user-card-directory/144479/29)를 사용하는 경우 적용됩니다. 이 코드는 @LeoMcA 님이 [Meta](https://meta.discourse.org/t/link-custom-user-field-to-external-website/41218)의 이 대화와 [Namati 사용자 카드 프로필 테마](https://github.com/LeoMcA/namati-user-card-profile-theme)에서 제공한 토론 및 코드 샘플에서 99% 복사한 것입니다. 다만, 해당 스레드에서 내용을 발췌하여 좀 더 범용적으로 수정해 공유하면 도움이 될 것 같아 올립니다. 참고 사항 항목 값이 없는 사용자의 경우, 해당 사용자 카드/프로필에 대응하는 아이콘이 표시되지 않습니다. Instagram 및 Twitter 커스텀 사용자 필드는 사용자 이름만 입력하도록 되어 있으며(“@” 기호 제외), 이름은 기본 URL에 추가됩니다. 아이콘이 표시될 커스텀 사용자 필드는 사용자 카드에 표시되지 않도록 설정하는 것을 권장합니다. 텍스트와 클릭 가능한 아이콘이 동시에 나타나면 …

---

<div class="post-metadata">

### Author: ![wilson29thid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wilson29thid/32/173700_2.png) [@wilson29thid](https://meta.discourse.org/u/wilson29thid)
#### Post date: [3월 6, 2021, 5:25오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/53 "2021-03-06T17:25:28Z")

</div>

안녕하세요, 이 [플러그인 버전](https://github.com/29th/discourse-custom-profile-link)을 만들었으니 공유하려고 합니다. 아주 기본적인 버전인데, 링크로 만들 사용자 필드를 지정하고, 선택적으로 접두사(예: `https://mysite.com/users/`)를 추가할 수 있습니다. 코드를 수정하기보다는 테마 컴포넌트를 설치하는 쪽을 선호하시는 분이 계실 수 있어 공유합니다. 이 스레드의 원본 게시글에 있는 코드를 기반으로 만들었습니다.

참고로, 제 특정 사용 사례에서는 사용자가 직접 편집할 수 없게 하려고 합니다. 대신 Discourse API를 통해 업데이트할 계획입니다. 이런 경우 "사용자 필드(user field)"보다 "사용자 정의 필드(custom field)"가 더 적합할까요? API에서 두 가지 모두를 볼 수 있는데, `custom_fields`는 비어 있습니다.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2월 7, 2022, 6:35오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/54 "2022-02-07T18:35:32Z")

</div>

@wilson29thid 이 컴포넌트에 대해 #Customization > Theme 토픽을 설정해 주실 의향이 있으신가요? 매번 코드를 복사/붙여넣기해야 하는 대신 설치 가능한 테마 컴포넌트로 제공되면 좋겠습니다.

---

<div class="post-metadata">

### Author: ![wilson29thid](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wilson29thid/32/173700_2.png) [@wilson29thid](https://meta.discourse.org/u/wilson29thid)
#### Post date: [2월 9, 2022, 5:23오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/55 "2022-02-09T17:23:37Z")

</div>

네, 여기에 해당 태그를 붙인 주제를 만들면 설치 가능한가요?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2월 9, 2022, 11:06오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/56 "2022-02-09T23:06:51Z")

</div>

이미 git URL을 통해 설치할 수 있습니다. 주제를 만들면 사람들이 더 쉽게 찾을 수 있도록 도와줍니다.

---

<div class="post-metadata">

### Author: ![Drew-ART](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@Drew-ART](https://meta.discourse.org/u/Drew-ART)
#### Post date: [7월 13, 2022, 4:30오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/57 "2022-07-13T16:30:09Z")

</div>

조금 다른 질문입니다. 가입 페이지의 사용자 필드 설명 부분에 새 창에서 열리는 링크를 추가하고 싶은데요. 해당 페이지는 `[this](format)` 형식으로 감싸진 링크를 인식하지 못합니다.

사용자들이 가입 전에 커뮤니티 가치관을 읽었는지 확인하고 싶은데, 링크가 있으면 놓친 경우에도 도움이 될 것 같습니다. 지금은 브라우저에 전체 링크를 복사/붙여넣으라고 안내하고 있습니다.

---

<div class="post-metadata">

### Author: ![frictionel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frictionel/32/299701_2.png) [@frictionel](https://meta.discourse.org/u/frictionel)
#### Post date: [2월 1, 2024, 6:44오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/58 "2024-02-01T18:44:20Z")

</div>

Discourse 3.2와 Ember 5에서는 어떻게 작동하나요?

버전을 `<script type="text/discourse-plugin" version="1.13.0">`으로 업데이트하고, [여기](https://github.com/discourse/discourse/blob/e61608d0808362b7e49953df27335a5067a412dc/app/assets/javascripts/discourse/app/lib/plugin-api.js#L976)에서 제안된 대로 `api.registerConnectorClass`를 `api.renderInOutlet`으로 변경했는데 브라우저 콘솔에서 [THEME 27] Error: klass is not an Ember component 오류가 발생합니다.

[여기](https://deprecations.emberjs.com/v3.x/#toc_function-prototype-extensions-property)에서 제안된 대로 property를 computed로 교체했는데 브라우저 콘솔에서 [THEME 27] ReferenceError: computed is not defined 오류가 발생합니다.

import를 깜빡했네요. 그래서 script 태그 시작 부분 뒤에 누락된 `import EmberObject, { computed } from '@ember/object';`를 추가했는데, 그 결과 SyntaxError: “/discourse/theme-27/discourse/initializers/theme-field-140-common-html-script-3: ‘import’ and ‘export’ may only appear at the top level.” 오류가 발생합니다.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2월 1, 2024, 10:38오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/60 "2024-02-01T22:38:29Z")

</div>

음, 맞아요. 원 게시글에서 제안된 기술들은 꽤 오래되었네요 (2016년에 작성된 글이라 그럴 만도 하죠 😅).

요즘에는 이런 것들은 git 저장소에 패키징해서 #customization:theme-component로 게시하고, 사람들이 설정을 통해 설치하고 구성할 수 있도록 해야 합니다.

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [2월 2, 2024, 2:20오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/63 "2024-02-02T14:20:43Z")

</div>

결국 @wilson29thid의 TC를 [여기](https://github.com/Firepup6500/discourse-custom-profile-link)에서 다시 작업했지만, 나중에 수정해야 할 비추천(deprecation) 경고가 여전히 남아 있습니다.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2월 2, 2024, 5:03오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/64 "2024-02-02T17:03:13Z")

</div>



---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [2월 15, 2024, 12:24오후 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/69 "2024-02-15T12:24:51Z")

</div>

OP의 이 기능은 이제 새로운 미니 컴포넌트에서 찾을 수 있습니다:

> [@사용자 지정 프로필 링크](https://meta.discourse.org/t/custom-profile-link/295470):
>
> discourse2요약 사용자 프로필에 사용자 지정 링크 추가hammer_and_wrench저장소 [GitHub - chapoi/discourse-profile-custom-link · GitHub](https://github.com/chapoi/discourse-profile-custom-link)question설치 가이드 [테마 또는 테마 컴포넌트 설치 방법](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682)open_bookDiscourse 테마를 처음 사용하시나요? [Discourse 테마 사용 입문 가이드](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) 이 테마 컴포넌트 설치 사용자 프로필에 사용자 지정 링크를 추가하는 작은 컴포넌트입니다. 표시 위치… 확장된 사용자 프로필 사용자 카드 설정 profile custom link field(프로필 사용자 지정 링크 필드)를 비워 두면 기본적으로 사용자 이름이 사용되므로, 예시와 같이 http://github.com/charlie로 이동합니다. 사용자가 직접 입력하는 필드를 사용하려면 값을 해…

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [5월 25, 2024, 7:03오전 UTC](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218/71 "2024-05-25T07:03:13Z")

</div>



[이전 페이지](https://meta.discourse.org/t/retired-use-an-id-in-a-custom-user-field-to-link-to-a-users-external-profile/41218.md?page=2)
