XF 1.4 Clickable user banners?

Been wondering the same thing. We have a departed member who's family is raising funds for leukemia research and anyone who donates is getting added to a usergroup so that their accounts show a special banner. I'd like to make the banner a clickable link to the thread about the fundraising efforts. In two days, we've raised over $1250 and we want to keep up the momentum.
 
Just did this for a client actually,

XF 2.x
Template: message_macros

Find:
Code:
<xf:userbanners user="$user" tag="div" class="message-userBanner" itemprop="jobTitle" />
Replace with:

Code:
<xf:if is="{{$user.isMemberOf(3)}}">
    <a href="#"><img src="banner3.png" /></a>
</xf:if>
<xf:if is="{{$user.isMemberOf(2)}}">
    <a href="#"><img src="banner2.png" /></a>
</xf:if>
<xf:if is="{{$user.isMemberOf(1)}}">
    <a href="#"><img src="banner1.png" /></a>
</xf:if>


XF 1.x
Template
: message_user_info

Find:
Code:
{xen:helper userBanner, $user, 'wrapped'}
Replace with:
Code:
            <xen:if is="{xen:helper ismemberof, $user, 4}">
            <a href="#"><img src="banne4.png" /></a>
            </xen:if>
            <xen:if is="{xen:helper ismemberof, $user, 3}">
            <a href="#"><img src="banner3.png" /></a>
            </xen:if>

This is a basic setup of course, you may need to add classes to help with additional styling.
 
@Russ this is BRILLIANT!

So, it looks like that does two things:

1) Sets a custom image for the banner
2) Sets the click URL for the image/banner

Is that correct?

Question: If we want to use the default banners and not have a custom image, what would the change be to the XF1.x code?

Thanks!!!
 
@Russ this is BRILLIANT!

So, it looks like that does two things:

1) Sets a custom image for the banner
2) Sets the click URL for the image/banner

Is that correct?

Question: If we want to use the default banners and not have a custom image, what would the change be to the XF1.x code?

Thanks!!!
Kind of easy, on my phone but basically copy your current userbanner html(like inspect element ) and copy and paste in that conditional instead of the image tag.
 
This is so cool!

Ok, so this is "all-or-nothing", meaning that once that default line is removed, any/all banners need to have manually set icons / links.

@Russ , is this what you have setup in the postbit on TAZ? https://theadminzone.com/threads/xenforo-license-validation.131594/#post-961528
(which I've always loved).

The only bit I'm now wondering about: on TAZ there's a nice mouseover that says what the icon is. Is this easy to add to the code you have above?

1533327812445.webp
 
This is so cool!

Ok, so this is "all-or-nothing", meaning that once that default line is removed, any/all banners need to have manually set icons / links.

@Russ , is this what you have setup in the postbit on TAZ? https://theadminzone.com/threads/xenforo-license-validation.131594/#post-961528
(which I've always loved).

The only bit I'm now wondering about: on TAZ there's a nice mouseover that says what the icon is. Is this easy to add to the code you have above?

View attachment 180959

Yepp all or nothing with this approach.

That's a default tooltip, pretty easy just add a class and a title:

Code:
<img src="#" class="Tooltip" title="This will show in a nice tooltip" />
 
Question: If we want to use the default banners and not have a custom image, what would the change be to the XF1.x code?
If I'm understanding you correctly, you'd just need to change Russ' code to something like this:
Code:
<xen:if is="{xen:helper ismemberof, $user, 4}">
    <a href="#"><img src="banne4.png" /></a>
<xen:elseif is="{xen:helper ismemberof, $user, 3}">
    <a href="#"><img src="banner3.png" /></a>
<xen:else />
    {xen:helper userBanner, $user, 'wrapped'}
</xen:if>
 
Thanks guys!

One other thing I noticed is that this only impacts "banners" in the postbit, right? The other areas the banners show (like the user-info popup modal, and members page, etc.) will still have the default banners?

I guess the only option is to edit all the templates for each of those items and replace all of them?

Is there no way to do this (use a specific pic and link the text) within the CSS of the individual banners so it's propogated throughout the entire system vs. editing / updating each individual template?

(Sorry if I'm not using the correct terminology... but hopefully you get what I'm saying)
 
Ya you will unfortunately have to edit those other areas, I think:

member_view, member_list_item (I think that's the name) and member card.

To make it automatically you could get an add-on commissioned that added a line to the userbanner area that would easily link them.

Another easy way of achieving it... create a new template with just userbanners in them (my conditionals above).
Then go into each area and replace the banner with the template include.
 
We have one custom user group we want to add a link to. We created a conditional based on this thread, however the problem is that if the criteria is met then the one banner is shown with the link and the other banners are left off. With several custom banners, is there some other way to write the code so that one banner has a link and the rest of the banners still show? It's not practical for us to individually check all banners with conditionals.

Code:
<xen:if is="{xen:helper ismemberof, $user, 8}">
    <a href="######">
    <em class="userBanner bannerSilver wrapped" itemprop="title">
    <span class="before"></span>
    <strong>Author</strong>
    <span class="after"></span>
    </em>
    </a>
<xen:else />
    {xen:helper userBanner, $user, 'wrapped'}
</xen:if>
 
Just did this for a client actually,

XF 2.x
Template: message_macros

Find:
Code:
<xf:userbanners user="$user" tag="div" class="message-userBanner" itemprop="jobTitle" />
Replace with:

Code:
<xf:if is="{{$user.isMemberOf(3)}}">
    <a href="#"><img src="banner3.png" /></a>
</xf:if>
<xf:if is="{{$user.isMemberOf(2)}}">
    <a href="#"><img src="banner2.png" /></a>
</xf:if>
<xf:if is="{{$user.isMemberOf(1)}}">
    <a href="#"><img src="banner1.png" /></a>
</xf:if>


XF 1.x
Template
: message_user_info

Find:
Code:
{xen:helper userBanner, $user, 'wrapped'}
Replace with:
Code:
            <xen:if is="{xen:helper ismemberof, $user, 4}">
            <a href="#"><img src="banne4.png" /></a>
            </xen:if>
            <xen:if is="{xen:helper ismemberof, $user, 3}">
            <a href="#"><img src="banner3.png" /></a>
            </xen:if>

This is a basic setup of course, you may need to add classes to help with additional styling.
Ohhhh can you do it for me? :)
 
I would like to continue using the CSS styled banners and not use images, but I am willing to only use a single URL for all banners that are displayed. Is there a way to add this static URL to every banner?
 
Back
Top Bottom