XF 2.2 Custom user field linked to banner?

ArtG

Active member
Hi all -

I'm trying to create a custom banner in the user info section. It will appear if the user inserts a URL in a custom user field in their profile.

The custom banner should link to the URL that was used in the profile. The banner will be the same for everyone but it should look like all the other Xenforo banners, just a different color and different text.

Here's what I did:

1. I created a custom user field and set the value to URL.
2. I clicked the box saying that it is viewable in the message info section and enabled it in message user info elements section.

The URL shows up correctly but I have two problems:

1. The custom user field title is showing and I don't know how to make it not show. Any thoughts?
2. I don't know how to call the css necessary to convert the URL link to a banner like the others in Xenforo. Anyone have any thoughts on how to call that?

Thanks!!
 
Last edited:
Use the General options location to customize what is shown?

1667436426118.webp

I do similar with some custom fields for posts and the media gallery

It will affect both on the member profiles and on the postbit though.
 
Unfortunately that doesn't do what I'm looking for.

I've tried adding this to the message_macros template:

<div class="message-userExtras"><span class="userBanner userBanner--orange message-userBanner")><a href="{$user.Profile.custom_fields.buildthread}">Build Thread</a></span></div>

It works for me, but not for everyone else. I have a custom user field called buildthread.

Ideally, this would only show if the user filled out their custom user field.

Any thoughts? @Brogan
 
Type in Wrapper Display:
HTML:
<div class="message-userExtras"><span class="userBanner userBanner--orange message-userBanner")><a href="{$value}">Build Thread</a></span></div>

Enable this for the field:
1670338034036.webp

And enable in Style -> Group: Messages the option for Custom Fields.
 
Hmm doesn't work.

So I get the banner and the link with the title Build Thread. That is working. However, what is not working is the URL. It isn't capturing the URL inserted by the USER in the custom field.

I have the custom user field set to URL, single-line box.

Then the following:

Screenshot 2022-12-06 at 9.46.18 AM.webp

Any thoughts @Hoffi? Thank you!
 
Sorry, I was able to fix this. However, the banner appears at the bottom of message user info block. Any thoughts on how I can move this up to where the user banners are?
 
Sure. For that you need to eit the message_info Template. Be sure to do this in your own style template.

Search for:
HTML:
                    <xf:if is="$extras.custom_fields">
                        <xf:macro template="custom_fields_macros" name="custom_fields_values"
                            arg-type="users"
                            arg-group="personal"
                            arg-set="{$user.Profile.custom_fields}"
                            arg-additionalFilters="{{ ['message'] }}"
                            arg-valueClass="pairs pairs--justified" />
                        <xf:if is="$user.canViewIdentities()">
                            <xf:macro template="custom_fields_macros" name="custom_fields_view"
                                arg-type="users"
                                arg-group="contact"
                                arg-set="{$user.Profile.custom_fields}"
                                arg-additionalFilters="{{ ['message'] }}"
                                arg-valueClass="pairs pairs--justified" />
                        </xf:if>
                    </xf:if>

and move it direct below
HTML:
            <xf:if contentcheck="true">
                <div class="message-userExtras">
                <xf:contentcheck>
 
Top Bottom