Highlight Threads made by Premium members?

icke

Member
So what would I need to do if I wanted to highlight threads where a certain usergroup has posted in?
 
Last edited:

Chris D

XenForo developer
Staff member
That would need an add-on with custom PHP code.

Reason being, the thread list doesn't know the details of every single post in every single thread. All it knows about is the details you see in the thread list itself.

If it was pulling a record of every single post and who created that post and what usergroups each user is in, the page would probably never load because it's a lot of data :)

This is how you highlight a thread which was created by a member of a certain usergroup:
http://xenforo.com/community/threads/highlight-threads-made-by-premium-members.49986/#post-534929

But that's all you'd be able to do really.

You've got the details of the very last poster in the thread record so you could highlight the thread if the last poster was in a certain usergroup but that's hardly worthwhile as that information changes so often.
 

Brent W

Well-known member
I found this thread via google. I would like to do this but I would like to do it for threads that are not in a certain forum. For example, if the thread is not in our off topic forum, I would like to have the threads highlighted on the new posts and recent posts pages.
 

Brent W

Well-known member
Does anyone know how to make .discussionlistitem .stats continue or use the same css as .discusionlistitem .premium? Please check the picture. I would like to use a box shadow for the thread, but when I use the same code fot the stats it has the box shadow on the sides. I want it to just be on the top and bottom so it just looks like a continuation of the discussionlistitem style, i.e one highlight, instead of 2.

So Ideally the highlight, would be on continuous highlight, instead of breaking up when it gets to the stats area.

View attachment 53576
Did you ever figure this out?
 

Brent W

Well-known member
Ok, so I just realized that this doesn't just affect the Recent Post and New Post pages lol. So how can I make it only affect those two pages?
 

RobParker

Well-known member
So you currently have this in your code:
Code:
AND {$thread.node_id} == 18
You would want to do something like:

Code:
AND in_array({$thread.node_id}, array(18,19,20))
Can that be used within a post?

Say I want to colour the post background started by a specific usergroup in a specific forum.

i.e. is thread.node_id accessible from within the post code?
 

RobParker

Well-known member
I'm a bit confused how I should do this now for XF2?

I want to colour a post background if the poster belongs to a specific usergroup. Is it the post macros template I edit?
 

Chris D

XenForo developer
Staff member
Yeah under the post macro which is inside the <xf:macro name="post" ... block.

Find:
Code:
message message--post js-post
And add directly after, something like:
Code:
{{ $post.User.isMemberOf('999') ? 'your-class-name' : '' }}
And of course change 999 to whatever your specific usergroup is, and add styling to extra.less, similar to:
Less:
.your-class-name
{
    background-color: red;
}
 

Xon

Well-known member
Yeah under the post macro which is inside the <xf:macro name="post" ... block.

Find:
Code:
message message--post js-post
And add directly after, something like:
Code:
{{ $post.User.isMemberOf('999') ? 'your-class-name' : '' }}
And of course change 999 to whatever your specific usergroup is, and add styling to extra.less, similar to:
Less:
.your-class-name
{
    background-color: red;
}
This should be;

Code:
{{ $post.User && $post.User.isMemberOf('999') ? 'your-class-name' : '' }}
Otherwise posts by guest/deleted users will cause template errors
 

Nergizo

Member
Thanks for the info!

I would like to highlight the replies of the premium members inside threads, any help?

Thank you
 

Breixo

Well-known member
Thanks for the info!

I would like to highlight the replies of the premium members inside threads, any help?

Thank you
Same question here :)

BTW, I'm not able to achieve any highlight :(

Tried at post_macros:
Code:
<article class="message message--post {{ $uix_condensed ? 'uix_message--condensed' : '' }} js-post js-inlineModContainer
{{ $post.User && $post.User.isMemberOf('3') ? 'your-class-name' : '' }} {{ $isIgnored ? 'is-ignored' : '' }} {{ $post.isUnread() ? ' is-unread' : '' }}"
        data-author="{{ $post.User.username ?: $post.username }}"
        data-content="post-{$post.post_id}"
        id="js-post-{$post.post_id}">

Extra.less:
Code:
.your-class-name
{
    background-color: red;
}
But got no results.
Any change at XF2.1?
 

Breixo

Well-known member
Any clue? I tried adding

{{ $post.User && $post.User.isMemberOf('999') ? 'your-class-name' : '' }}

at several places but no results :(
 
Top