Highlighted posts

lazarote

web enthusiastic
Collaborate
Registered
Joined
Jun 24, 2019
Messages
142
Points
53

Reputation:

Hi, today I was checking the Invision Community website and I came across this feature:

1640817544039.jpg


I would like to replicate it in Xenforo and make it based on user groups. Any idea how to proceed?

I know I can't use conditionals because it would only make it visible to certain user groups, and that's not my goal.



Something Like This https://enxf.net/resources/user-message-background.2332/


The Div i want to edit is this one:

HTML:
<div class="message-cell message-cell--main" style="">
 

lazarote

web enthusiastic
Collaborate
Registered
Joined
Jun 24, 2019
Messages
142
Points
53

Reputation:

Deleted

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,514
Points
523

Reputation:

My progress so far, I still can't find a way to make it specific to each usergroup:


lazaroteNice idea, pls could you point to the InVision Board Addon which provide that feature.

So you would like to highlight just posts of a specific user group, is that correct. What kind of stuff you already implemented, would be nice if you could sent me a PM
 
View previous replies…

lazarote

web enthusiastic
Collaborate
Registered
Joined
Jun 24, 2019
Messages
142
Points
53

Reputation:

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,514
Points
523

Reputation:

here the link, it is a default option of Invision

https://invisioncommunity.com/features/forums/

I'll send You a PM
lazaroteyou could try to change something like this in post_macro template:

PHP:
                    <div class="message-cell message-cell--main <xf:if is="(in_array(5, {$post.User.user_group_id}) OR in_array(5, {$post.User.secondary_group_ids}))">your_class</xf:if>">

configure your class in extra.less to paint the frame or background.
 

lazarote

web enthusiastic
Collaborate
Registered
Joined
Jun 24, 2019
Messages
142
Points
53

Reputation:

you could try to change something like this in post_macro template:

PHP:
                    <div class="message-cell message-cell--main <xf:if is="(in_array(5, {$post.User.user_group_id}) OR in_array(5, {$post.User.secondary_group_ids}))">your_class</xf:if>">

configure your class in extra.less to paint the frame or background.
BattleKingIt totally worked, how could I implement it for multiple groups with various different styles? .staff_highlight ; .mod_highlight ; .vip_highlight

Happy New year btw :D
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,514
Points
523

Reputation:

It totally worked, how could I implement it for multiple groups with various different styles? .staff_highlight ; .mod_highlight ; .vip_highlight

Happy New year btw :D
lazaroteyou could try to change something like this in post_macro template:

PHP:
                    <div class="message-cell message-cell--main <xf:if is="(({$post.User.user_group_id}==5) OR in_array(5, {$post.User.secondary_group_ids}))">staff_highlight<xf:elseif is="(({$post.User.user_group_id}==3) OR in_array(3, {$post.User.secondary_group_ids}))" />mod_highlight<xf:elseif is="(({$post.User.user_group_id}==2) OR in_array(2, {$post.User.secondary_group_ids}))" />vip_highlight<xf:else /></xf:if>">

Please be aware to start first with the highest one. I also changed one of the statements, user_group_id is just a number and not an array, so just check this in a different way.

The first one got staff_highlight and the second in the screenshot the vip_highlight

1641390526300.jpg


You can also do this kind of change via template modification.
 

lazarote

web enthusiastic
Collaborate
Registered
Joined
Jun 24, 2019
Messages
142
Points
53

Reputation:

you could try to change something like this in post_macro template:

PHP:
                    <div class="message-cell message-cell--main <xf:if is="(({$post.User.user_group_id}==5) OR in_array(5, {$post.User.secondary_group_ids}))">staff_highlight<xf:elseif is="(({$post.User.user_group_id}==3) OR in_array(3, {$post.User.secondary_group_ids}))" />mod_highlight<xf:elseif is="(({$post.User.user_group_id}==2) OR in_array(2, {$post.User.secondary_group_ids}))" />vip_highlight<xf:else /></xf:if>">

Please be aware to start first with the highest one. I also changed one of the statements, user_group_id is just a number and not an array, so just check this in a different way.

The first one got staff_highlight and the second in the screenshot the vip_highlight

View attachment 27237

You can also do this kind of change via template modification.
BattleKingi just create a template and used the
HTML:
<div class="message-cell message-cell--main <xf:include template="post_highligh"/>">
 

Samuel

Well-known member
Registered
Joined
May 13, 2021
Messages
84
Points
28

Reputation:

Hi, @lazarote , @BattleKing , in the post_macros you should do this:

find <xf:extension name="main_cell">

and add this code below:

HTML:
<xf:if is="$post.User.user_group_id == 3">
        <div class="message-cell message-cell--main staff_highlight">
                    <xf:else />
        <div class="message-cell message-cell--main">
                    </xf:if>

Number "3" is your Group ID and "staff_highlight" is your class.

put this code in your extra.less.

CSS:
.staff_highlight {
border: 2px solid red;
box-shadow: 0 0 10px red;
}

Or add any style you like....!

-------------------------------------------

and you can replace this code:

HTML:
<xf:if is="in_array({$post.User.user_group_id}, [2,3,4,5])">

with:

HTML:
<xf:if is="$post.User.user_group_id == 3">

to add more Group ID's. its done. Like image :

ob_empolay.png


Good Luck.
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,514
Points
523

Reputation:

Hi, @lazarote , @BattleKing , in the post_macros you should do this:

find <xf:extension name="main_cell">

and add this code below:

HTML:
<xf:if is="$post.User.user_group_id == 3">
        <div class="message-cell message-cell--main staff_highlight">
                    <xf:else />
        <div class="message-cell message-cell--main">
                    </xf:if>

Number "3" is your Group ID and "staff_highlight" is your class.

put this code in your extra.less.

CSS:
.staff_highlight {
border: 2px solid red;
box-shadow: 0 0 10px red;
}

Or add any style you like....!

-------------------------------------------

and you can replace this code:

HTML:
<xf:if is="in_array({$post.User.user_group_id}, [2,3,4,5])">

with:

HTML:
<xf:if is="$post.User.user_group_id == 3">

to add more Group ID's. its done. Like image :

View attachment 27164


Good Luck.
SamuelIs it not the same I've already posted ;)
Anyway as I mentioned you also need to check the secondary group ids
 
View previous replies…

Samuel

Well-known member
Registered
Joined
May 13, 2021
Messages
84
Points
28

Reputation:

Is it not the same I've already posted ;)
Anyway as I mentioned you also need to check the secondary group ids
BattleKingin_array(5, {$post.User.user_group_id})
OR
in_array(5, {$post.User.secondary_group_ids}))

Array codes that you sent is incorrect and does not work in xenforo 2.2 my brother. it needed to be fixed, which I did. I hope you start a good year :love: 🔥
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,514
Points
523

Reputation:

in_array(5, {$post.User.user_group_id})
OR
in_array(5, {$post.User.secondary_group_ids}))

Array codes that you sent is incorrect and does not work in xenforo 2.2 my brother. it needed to be fixed, which I did. I hope you start a good year :love: 🔥
SamuelWhy does it not work in 2.2 I tested the code before posting and it was working, i'm now confused

Same to you my friend.
 

lazarote

web enthusiastic
Collaborate
Registered
Joined
Jun 24, 2019
Messages
142
Points
53

Reputation:

in_array(5, {$post.User.user_group_id})
OR
in_array(5, {$post.User.secondary_group_ids}))

Array codes that you sent is incorrect and does not work in xenforo 2.2 my brother. it needed to be fixed, which I did. I hope you start a good year :love: 🔥
SamuelI wonder why your code didn't work for me, I don't understand 🤔
 

one_finger_man

Well-known member
Registered
Joined
Jan 20, 2022
Messages
383
Points
53

Reputation:

Hi, today I was checking the Invision Community website and I came across this feature:

View attachment 27150

I would like to replicate it in Xenforo and make it based on user groups. Any idea how to proceed?

I know I can't use conditionals because it would only make it visible to certain user groups, and that's not my goal.



Something Like This https://enxf.net/resources/user-message-background.2332/


The Div i want to edit is this one:

HTML:
<div class="message-cell message-cell--main" style="">
lazaroteare you trying to high light the topic its self or just the outside frames
 

one_finger_man

Well-known member
Registered
Joined
Jan 20, 2022
Messages
383
Points
53

Reputation:

ok good my bad did not see the bottom of the post the forums are not so really good
 
Last edited:
Top