Skip to:
Content
Pages
Categories
Search
Top
Bottom

A question about icons


  • spartanburgspark
    Member

    @spartanburgspark

    I have what I hope is a fairly easy question to answer: On the WordPress side of my site (running 2.8.5), I have a custom script that loads a small icon showing the status of users who have donated to the site, as well as for staff members. As you’ll see below, it calls the user_id and then looks for and displays an image with the matching name.

    <?php $user = new WP_User( $comment->user_id );

    if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    foreach ( $user->roles as $role )
    echo "<img src='/{$role}.gif' />";
    } ?>

    I’d like to introduce this to the forum side as well. I’m running bbPress 1.0.2, and it’s fully integrated, and I’m trying to add this to the standard Kakumei template in the post.php file, above the post_author_avatar_link line. It doesn’t appear to break anything, but it also doesn’t load the image, or show a broken image link that would hint that there’s no appropriate image to be found.

    It also appears to recognize the WP_User term, but not BB_User (it breaks with an error when changed).

    Any ideas how I can get this working for at least the staff levels (keymasters, admins, moderators)?

Viewing 1 replies (of 1 total)

  • hatter
    Member

    @hatter

    If you’re trying to get the user for the current post in post.php, you might want to use:

    $user=bb_get_user(get_post_author_id());

    This should get the user for the current post author. Then you can loop through the roles.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar