XF 2.1 Change the background of a post to certain groups

Yu_Xiu

Member
I'm not sure how i can approach this basically if the user in group for example administrator his post's background will be a certain color tho thats not limited to staff would like to know how to do it to other groups too

thanks!

PS.
Code:
<xf:if is="{{$xf.visitor.isMemberOf(x)}}"> <!-- yes i changed the x -->

               Show content

</xf:if>
this didn't work logically to what i was looking for it just made it so if he's in group the background changes for all the users and not appear for other users

so then what i did was use jquery + xf:if and instead of xf.visitor i used thread.user

Code:
<xf:if is="{{$thread.User.isMemberOf([1, 2, 3, 4])}}">

  <xf:js>

      $(document).ready(function() {

      $(".message-cell--main").addClass("red");

      });

    </xf:js>

  <xf:css>

    .red {

    background-color: #f9e4e4 !important;

    </xf:css>

</x:if>
now what it did was add class red to all the posts no matter of your group.id i am thinking that thread.User is at fault and there is something else that i should be possibly using? or i am straight up approaching this the wrong way ;(
basically i think im asking for the $ of the user who posted a reply or the thread itself i have the one for the thread itself just not the replies i guess?
 
Last edited:
Got it if anyone requires these feel free to reply to this thread will post the way^^ that way was logically wrong and is unnecessary
 
Last edited:
Back
Top Bottom