Forums

Join
bbPress Support ForumsThemesDifferent Style for Key Master and Administrator replies?

Different Style for Key Master and Administrator replies?

  1. Hi,

    I've tried searching the forums but haven't found what I'm looking for.

    In WordPress, it's possible to style the post author's comments to look different from other comments.

    In bbPress, is it possible to style the Key Master's replies and the Administrators/Moderators replies to look different from all the other members' replies?

  2. It's really good idea - and it can be done, but I'm not sure of the code behind it. If it were me, I'd simply do a template edit to get it right; simply by determining the user's status, and then using a different post CSS class to make it look different.

    Some would suggest a plugin for this however. If I find a way to do it, I will let you know. :)

  3. My coding really isn't that advanced yet, so I appreciate the help.

  4. I have a function for WordPress that outputs some code into the class section of an item:
    e.g. <li class="<?php my_custom_class_ouput_function(); ?>"> comment/thread </li>

    It outputs the user's level after a specific string (e.g. user_level_5), the author's name after a string (e.g. author_username_bob ), is the user an author (e.g. user_is_an_author) and if the user is the author of the original thread/blog post (e.g initial_author).

    You can then set up the styles as you want to display them in CSS.

    I'll have a look at porting this to BBpress later on.

  5. I was working on a plugin, which adds a filter to the delete class and then check if the post is by topic author/mod/admin, but then stopped working on it. I'm thinking to complete that plugin soon.

  6. Wow, that's very encouraging. :)

  7. @gautam, that would be greatly appreciated! :)

  8. i had this same issue.

    here's what i did:

    in /your-theme-folder/topic.php make these changes

    <?php
    //get user id
    $user_id = get_post_author_id();
    
    //get user role
    $role = get_user_type($user_id);
    
    // if user is a key master or Administrator add css class
    if ($role == 'Key Master' || $role == 'Administrator') {
    $adminclass = "class='adminpost'";
    }
    //otherwise don't add a class
    else {
    $adminclass = "";
    }
    ?>
    
    <!--add your css class to the li tag-->
    <li id="post-<?php post_id(); ?>" <?php echo $adminclass; ?>>
    

    then style your .adminpost class however you'd like.

    hope that helps.

    alanna

  9. You must log in to post.