I was working on setting up my fork of the Custom Profile Link Component, and I needed two for different site links. However, currently, only users who have a username set for both sites show up. How can I ensure that both show up regardless of whether the other copy works or not?
Honestly, it might not be the data-template, but thatâs what I guessed it might be from looking at it for a bit.
Iâm not fully grasping what you are doing but perhaps itâs because you are writing to the same handlebars template twice rather than once (with two fields)?
That was my suspicion as well, but Iâm not sure how to work around that.
can you not use one template? should be able to setup two fields on it, unless I am misunderstanding what you are trying to do. Did you get one link field to work? If you did, thatâs great
One of the templates is for the user card, the other is for the user profile, so I donât think so.
It works when one of two conditions are met:
- You have two copies, two fields and the user youâre viewing has both names filled out
- You have one copy, one field, and the user youâre viewing has the name filled out
oh ok, I misunderstood, I figured you were putting 2 different links on the user card. Now it makes sense. yea two templates.
I am, in a way, since Iâm using one per copy of the Theme Component, which I suspect to be the root of the problem. I could be wrong about that though.
I fed that chunk of code into Lola bot with no context and here was her reply:
Are you saying that you forked the theme and then include your fork and the original one? Youâll need to change all of the references to itâs variables and the id passed to modify class.
The original no longer functioned properly on Discourse, so I created a fork and revised it until it worked. At this time, Iâve installed two copies of my fork, which seem to be conflicting with each other.
Thatâs what Iâm saying. Youâll need to rename stuff so that it doesnât conflict.
You likely want to make one theme do both things rather than having two copies.
How would I do that exactly? One thought I had was to add the TCâs ID to the handlebars, but Iâm not sure how I would do that.
Wouldnât that sort of break the original use-case of this theme component?
I donât know, but I though it was broken already?
If it adds a link using a custom field and you want it to add two then youâd write it such that it could be configured to include any number of links to custom fields?
I made my fork to fix bugs with the original, so Iâd hope mine isnât broken.
That could work, but Iâm not sure how to do that.
Iâve started working on this. My first real roadblock here is processing multiple IDs. I think I would do it using a foreach
loop (like Iâve done higher in the code), but Iâm unsure how to do that in Handlebars.
Iâm unsure how to do that in Handlebars
Sounds like youâre on the right path.
I can never remember and Google âhandlebars for loopâ and find examples.
After fiddling with this for about an hour, Iâm going to say Iâm stumped. This code:
{{#each this.customProfileLink as |links|}}
<a href="{{link.[2]}}{{link.[0]}}" target="_blank">{{link.[1]}}</a>
<p>{{link}}--{{link.content}}</p>
{{/each}}
Feels like it should work, but everything I can find on #each
seems to vary, and this doesnât work. Anyone have any insight here?
And that one was doubly on me. Used links
for the item, and link
in the processor. And I didnât check the user profile, only the user card (User profile was correct for some reason)