Support Forum

Limit Roles Showing under User

TI TIMM
TIMM
Member

Hey all,

As you can see in the screenshot attached there is multiple roles showing for our members, most of them superfluous but we do make use of the multiple roles for other reasons, so going back to just one is not really an option. Is there an easy way to change this?

 ss2.jpg

Thanks,

Michael

7 Answers

New Answer

SP Simple Press
Simple Press
Admin

Hi:

I’m not sure what you’re asking here when you say “Is there a way to change this”.  Can you be a bit more specific as to what you need to change – from what to what?

Thanks.

TI TIMM
TIMM
Member

Under the Username and Avatar, there is a list of the users roles in this case, (New Member, Member, Mentor, Mentor Snuffles) we originally had only single WordPress roles, in Snuffles’ case it was just “Mentor”, we had to move to multiple roles for various things and now all the roles show instead of just the main one.

 

Thanks,

Michael

SP Simple Press
Simple Press
Admin

Hi:

Some CSS might do the trick.  Try putting something like this in your FORUM->THEMES->CUSTOM CSS area:

#spPostIndexUserMemberships20 span:nth-of-type(1) ~ span {
display: none;
}

Thanks.

TI TIMM
TIMM
Member

I think we are on the right track of using CSS to do display: none, but that snippet didn’t seem to do the trick, might need a little more to it. Any ideas on how to continue with this snippet?

Thanks,

Michael

SP Simple Press
Simple Press
Admin

That’s the code that worked on our test site – you can see the thread here: https://wp50test01.vnxv.com/forum/a-private-forum-for-members/what-roles-does-this-user-have/.  (You might have to register an account to see the thread).

Once you’re viewing the thread, the user spuser02 has three memberships (Guests, Members and VIP).  But only the first one is shown – “Guest”.  You can see the other hidden two if you look in the html source code (search for the string “VIP” and you’ll get to the area where that data is located).  

Your classes or IDs might be different for various reasons so you might have to use your browser tools to get the right CSS IDs and Classnames. 

Thanks.

TI TIMM
TIMM
Member

Ok that did point me in the right direction, the first one in the list was 3 then 4, so would i have to add the custom CSS for each user, it is working when I did that, I don’t know that you can do a loop in CSS, but I would be handy.

Michael

TI TIMM
TIMM
Member

I ended up using the following, it turned them all off but keeps the member status of the forums:

.spPostUserMemberships { display: none !important; }