Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Colored comments for specific users

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #189972
    Miguel
    Participant

    Let’s say I make a website where you can make your own account and post comments on the website, how can I make it so that when a specific user has a colored comment every time they post.

    I’m having a very difficult time trying to figure this out.

    #189973
    Senff
    Participant

    This depends very much on the commenting system you’re using, how the user roles/names are determined, in what language the system is done, etc. etc.

    But basically, what you could do is something like this in the code that displays a comment (basic PHP structure):

    if (user == "Bob") {
        echo '<div class="comment green">';
    } else {
        echo '<div class="comment">';
    }
    
    echo $comment_or_something;
    echo '</div>';
    

    Then with CSS, you can target the class “green”.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.