The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    Different background in post for different users?

    Supajin
    Supajin
    Forumember


    Posts : 38
    Reputation : 1
    Language : english

    Solved Different background in post for different users?

    Post by Supajin June 30th 2019, 5:07 pm

    Hello, is it possible to change background color or image of post body for different users?
    If it is, how to do that? Smile
    (For example, I want green background, and all other users want blue, so how can i set green
    background in my posts?)

    Please help, thank you.


    Last edited by Supajin on June 30th 2019, 11:02 pm; edited 1 time in total
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1187
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    Solved Re: Different background in post for different users?

    Post by Ikerepc June 30th 2019, 6:18 pm

    Hi.

    You can use this tutorial: https://help.forumotion.com/t115828-change-the-background-in-function-of-the-gender-of-the-poster#757421

    Just put class in user title and instead of looking for gender class look for class of user title.

    If you need more help on this, ask, I can lead you step by step Wink
    Supajin
    Supajin
    Forumember


    Posts : 38
    Reputation : 1
    Language : english

    Solved Re: Different background in post for different users?

    Post by Supajin June 30th 2019, 6:30 pm

    ohh, I'm not that good with javascript, can you set it to my forum?
    And one more question, can i make this with user ID?

    For example:
    User1(id: 1)
    User2(id: 2)

    function(): if id=1 do background: url(image);
    function(): if id=2 do background: green;

    Something like this?? Shrug
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1187
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    Solved Re: Different background in post for different users?

    Post by Ikerepc June 30th 2019, 6:53 pm

    I think that would be easier with ranks but I can make that for user id's too.

    So firstly you should edit rank you are having on forum. But instead of just writing a name, add html tag like this:

    if your rank is "Staff" change it to:
    <span class="staff">Staff</span>

    So you just add span around that text.

    Nextly add to your css following:

    Code:
    .staffbg {
      background: blue;
    }

    Just instead of blue add color you want. In html format or written.
    Now enable JavaScript and add following code:

    Code:
    $(function() {
             
              //Indicate here the version of your forum.
              var version = "phpBB3";
             
              if(version.toLowerCase() == "phpbb2"){ 
                  $(".postdetails span[class='staff']").closest('.postdetails').parent('td').next('td').addClass("staffbg");
              }else if(version.toLowerCase() == "phpbb3"){ 
                  $(".postprofile span[class='staff']").closest('.postprofile').prev('.postbody').addClass("staffbg"); 
              }else if(version.toLowerCase() == "punbb"){ 
                  $(".user-info span[class='staff']").closest('.postmain').addClass("staffbg");
              }else if(version.toLowerCase() == "invision"){       
                  $(".postprofile span[class='staff']").closest('.post-container').addClass("staffbg");
              }
            });

    replace phpBB3 in first line with forum version you are using.
    Placement for that code should be "In the topics".

    If you are using ID, you would need to edit JS for each user using that color if you want to add more at some point, but this way you only need to assing them this rank. But if you want it done with ID, I can do that too.
    Supajin
    Supajin
    Forumember


    Posts : 38
    Reputation : 1
    Language : english

    Solved Re: Different background in post for different users?

    Post by Supajin June 30th 2019, 7:11 pm

    Damn, I'm stupid, can I send you link of the forum, and than you can set it?
    Here's the link: http://world-of-eternal-war.forumotion.me/

    I will send you Name and Password in dm...
    Please do it for me, I'm desperate Sad
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1187
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    Solved Re: Different background in post for different users?

    Post by Ikerepc June 30th 2019, 7:38 pm

    So now whole post is in one color, but just for users with rank Admin (one you have).
    You want different color for others or transparent as it seems to be by default?

    Also, if you want to play with transparent colors you should check rgba: https://www.w3schools.com/cssref/func_rgba.asp

    It is just blue now and you can change that at acp -> display -> colors -> css -> .staffbg at the end of css file
    Supajin
    Supajin
    Forumember


    Posts : 38
    Reputation : 1
    Language : english

    Solved Re: Different background in post for different users?

    Post by Supajin June 30th 2019, 7:45 pm

    Wooooww, finalyy, awesomeee!!!
    Can you make it for postprofile maby??
    It would be so cool !
    Im so happy, thank you!
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1187
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    Solved Re: Different background in post for different users?

    Post by Ikerepc June 30th 2019, 7:47 pm

    Supajin wrote:Wooooww, finalyy, awesomeee!!!
    Can you make it for postprofile maby??
    It would be so cool !
    Im so happy, thank you!

    So you want only postprofile, postbody or whole post be in color?
    Only postprofile?
    Supajin
    Supajin
    Forumember


    Posts : 38
    Reputation : 1
    Language : english

    Solved Re: Different background in post for different users?

    Post by Supajin June 30th 2019, 7:49 pm

    Both, different color for postrow and postinfo Smile
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1187
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    Solved Re: Different background in post for different users?

    Post by Ikerepc June 30th 2019, 7:54 pm

    Ok, so If I understood, you have users and admins.

    Admins will have different color of posts than users.

    There is different background for postprofile and for postbody.

    Are postbody colors same for users and admins?
    Are postprofile colors different than postbody for both of them?
    Supajin
    Supajin
    Forumember


    Posts : 38
    Reputation : 1
    Language : english

    Solved Re: Different background in post for different users?

    Post by Supajin June 30th 2019, 8:01 pm

    I will make new rank for any user, and than i want to change backgrounds of their postbodies and postprofiles Smile
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1187
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    Solved Re: Different background in post for different users?

    Post by Ikerepc June 30th 2019, 10:41 pm

    Ok, it is done and online on your site.

    You can change postprofile as well as post background for any user.

    You only need to use following classes in css:

    .u{num} for profile background
    .u{num}post for post background.

    You have backgrounds for u1 and u2 (user 1 and user 2) so you can use that for example...
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19432
    Reputation : 2010
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Different background in post for different users?

    Post by Ape July 1st 2019, 12:29 am

    @Supajin as this is marked solved i will close this topic.

    If it's not solved please send me a PM with the link to this thread and i will reopen it.
    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    Different background in post for different users? Left1212Different background in post for different users? Center11Different background in post for different users? Right112
    Different background in post for different users? Ape_b110
    Different background in post for different users? Ape1010

      Current date/time is November 12th 2024, 12:02 am