XF 1.3 Hide UserGroup Banner based on different UserGroup

Staxed

Active member
Wasn't really sure how to word the title...but what I'm trying to do is hide certain secondary usergroup banners if the user is also a member of other specific usergroups.

I.E. If member is part of admin usergroup, do not show donator group banner.

I can get the first part of it using a simple:
<xen:if is="{xen:helper ismemberof, $visitor, 1} AND {xen:helper ismemberof, $visitor, 2}">
1 being admin, 2 being donator...but I'm not sure what I have to do next in order to hide the specific banner for group 2.

Hopefully I'm making sense.
 
Because in some cases I need more than one banner to show.

It is for a gaming community where certain members can be part of the main admin team, or just part of one of the specific gaming admin teams, or both (or more).

For these members that are in both, I need it to show both of those UserBanners, but right now I have my user donations to automatically add the donators secondary group when members donate. So if one of these members donates it adds the donators usergroup banner as well, which I don't want staff members to have.
 
Last edited:
There isn't a solution for this as far as I am aware - you can't have just selected user banners showing, it's either just one or all of them.

I require the same thing so I have posted a suggestion.

http://xenforo.com/community/thread...mixture-of-stackable-and-non-stackable.72534/

If you agree, please like the suggestion.

It may not be possible using existing settings via the control panel, but there has to be a way that it can be done manually via template edits like I'm trying to do.
 
If you can display one or them all there must be a way to modify the php script for the non stack and increase display to x variable instead of only 1. I'm going to look and see what i can do because i'll also need the same thing.

library\XenForo\Template\Helper\Core.php Check in there.

Got it working with a quick ugly hack lol, that prob shouldn't be used to be honest but works for now!

Heres how to do it, you prob will need to go a bit deeper and tell it which pages for it to ignore maybe because atm it does it for ALL profile + forum posts where ever it displays it now limits how many shows.

First you just setup a variable counter in PHP, and drop the counter limit. something like this:

NOTE: This is from core.php from a 1.2.5 duno if its different or not.

Search for: foreach (self::$_userBanners AS $groupId => $banner)

Replace with:
Code:
$bannercount = 0;
        foreach (self::$_userBanners AS $groupId => $banner)

        {

            if (!in_array($groupId, $memberGroupIds))

            {

                continue;
            }

       
            if($bannercount==3)
            {
            $banners[$groupId] = '<em class="' . $banner['class'] . ' ' . $extraClass . '" itemprop="title"><span class="before"></span><strong>' . $banner['text'] . '</strong><span class="after"></span></em>';
            break;
            }else{
            $banners[$groupId] = '<em class="' . $banner['class'] . ' ' . $extraClass . '" itemprop="title"><span class="before"></span><strong>' . $banner['text'] . '</strong><span class="after"></span></em>';
            $bannercount++;
            }
   
        }

Change if($bannercount==3) from 3 to how many you wish to display, note it counts from 0, so 3 = 4..

this will limit the display output of the usergroup banners to that limit based on Style positioning highest overrules.

May the Xenforo gods not smite me with my crappy hack up lol.

PS: you prob could use if (!in_array($groupId, $memberGroupIds)) to do what you need martok under the output area for banners based on group id. though again prob would be better if someone wrote an addon for it. Maybe I will learn how to do these addons some time soon.
 
Last edited:
Back
Top Bottom