사용자 지정 프로필 링크

:discourse2: 요약 사용자 프로필에 사용자 지정 링크 추가
:hammer_and_wrench: 저장소 GitHub - chapoi/discourse-profile-custom-link · GitHub
:question: 설치 가이드 테마 또는 테마 컴포넌트 설치 방법
:open_book: Discourse 테마를 처음 사용하시나요? Discourse 테마 사용 입문 가이드

이 테마 컴포넌트 설치

사용자 프로필에 사용자 지정 링크를 추가하는 작은 컴포넌트입니다.

표시 위치…

  1. 확장된 사용자 프로필

  2. 사용자 카드

설정

profile custom link field(프로필 사용자 지정 링크 필드)를 비워 두면 기본적으로 사용자 이름이 사용되므로, 예시와 같이 http://github.com/charlie로 이동합니다.

사용자가 직접 입력하는 필드를 사용하려면 값을 해당 사용자 필드의 정확한 이름으로 설정해야 합니다. 예시:

  1. 사용자 필드 생성

  2. 설정을 사용자 필드 이름으로 지정

  3. 사용자에게 해당 필드를 채우도록 안내
    /u/[username]/preferences/profile

이제 http://github.com/MyRealGithubName으로 이동합니다.


더 고급스러운 구현을 원하시면 Multiple Custom Profile Links 컴포넌트를 확인해 보세요.

24개의 좋아요

Does this get “nofollow”? Will it be sent akismet?

This is definitely going to be used by spammers!

1개의 좋아요

Just a quick nitpick, that should be http://github.com/, right?

Also, any particular reason why this suggests http GitHub instead of https?

4개의 좋아요

Haha yes, that’s a typo. Thanks. I’m not reinventing url structures here :winking_face_with_tongue:

Not at all

4개의 좋아요

Hey @chapoi ! So glad I found this component. I’ve just added to our forum, thanks! I might even switch to the “multiple link” version.

Quick note: there is an extra “the” in the description text below the “profile custom link icon” field :slight_smile:

Is there a specific reason I have to add a component for this, instead of adding another field type for the User Fields?

Cheers

2개의 좋아요

Nice catch. :+1: This should tidy it up:

https://github.com/discourse/discourse-profile-custom-link/pull/7

4개의 좋아요

I’m not sure I follow the question. User fields aren’t all automatically shown on the profile or usercard.

2개의 좋아요

Hey Charlie,
sorry for not being clearer. It would be great if there was a field type for user fields, that allows links instead of just text.

Or are we utilising User Fields all wrong? Here is how we are using them right now:

Links have to be copy-pasted instead of just being clickable.

1개의 좋아요

Ok now I follow, thanks!

Yeah, that’s actually a fair point you bring up. I’ll look into the possibility of your suggestion; my guess is that there is a reason why that wasn’t done, but I don’t know atm.

2개의 좋아요

Awesome, thanks! :bouquet:

1개의 좋아요

So, I had a look but the necessary changes are way above my designer skills (read: backend databas-y stuff) – so I’m afraid it will be necessary to use the plugin.

An option you could consider is making a feature request, and seeing if that garners more interest.

Cheers!

2개의 좋아요

This solution is great and I hope we can help improve it. Our profile link is of the form “https://www.domain.com/user/[USER-ID]/”. The trailing slash wrecks the solution for us. I can add a URL rewrite but a better solution would be to make the code more adaptive. I want working real links back to the site!

I tried to convert the plugin to a theme so I could improve the javascript but that CONVERT Discourse function doesn’t seem to be working.

Can you make the update so that it adds functionality?


import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { service } from "@ember/service";

export default class ProfileCustomLink extends Component {
  @service site;
  @tracked customLinkUrl;
  @tracked customLinkFieldId;
  @tracked showCustomLink = false;
  @tracked user = this.args.model.username;
  @tracked userFields = this.args.model.user_fields;

  constructor() {
    super(...arguments);

    if (settings.profile_custom_link_field) {
      const siteUserFields = this.site.user_fields;

      if (!siteUserFields) {
        return;
      }

      const customLinkField = siteUserFields.filterBy(
        "name",
        settings.profile_custom_link_field
      )[0];

      if (!customLinkField) {
        return;
      }

      this.customLinkFieldId = this.userFields[customLinkField.id];
      if (!this.customLinkFieldId) {
        return;
      } else {
        this.showCustomLink = true;
        if (settings.profile_custom_link_prefix.includes("[CUSTOM-LINK-FIELD-ID]")) {
          const url = settings.profile_custom_link_prefix.replace("[CUSTOM-LINK-FIELD-ID]", this.customLinkFieldId);
          this.customLinkUrl = url;
        } else {
          const url = settings.profile_custom_link_prefix + this.customLinkFieldId;
          this.customLinkUrl = url;
        }
      }
    } else {
      const url = settings.profile_custom_link_prefix + this.user;
      this.customLinkUrl = url;
      this.showCustomLink = true;
    }
  }
}

@Julian2 I have just posted a feature request for this here, didn’t see your posts on this topic

2개의 좋아요

This component seems to have stopped working on v2025.11

[THEME 2 'Custom Profile Link'] Deprecation notice: The array.filterBy is a deprecated Ember native array extension. Use native array methods or a TrackedArray instead. [deprecated since Discourse 3.6.0.beta1-dev] [deprecation id: discourse.native-array-extensions.filterBy]

1개의 좋아요

I’m on 2025.12 and it still seems to work for me. That’s just a deprecated warning, not an error, so it should still be fine.

Can you tell me more about what you’re experiencing?

1개의 좋아요

Indeed, the actual issue turned out to be caused by a user error.

3개의 좋아요