Skip to:
Content
Pages
Categories
Search
Top
Bottom

Topic Icons Default Icon (Advanced request)

  • @anandasama

    Member

    I am using the Topic Icons plugin and it works great! However I’d like to display a “Default” Icon as a fallback if the Topic Icon plugin doesn’t do it for me.

    Ever since I started using Buddypress and integrated BbPress, Users can now use forum in “Groups” section. When a user creates a new group, A new subforum will appear. So that’s why I need to have a fallback Icon. I can’t manually sit and add numbers everytime there is a new subforum created.

    I already have a script for not showing these subforums in my Forums list.

    So another option than using a default topic icon would be to filter these topics (From the subforums) out from the Latest Discussions. But then I need a script in Latest Discussions to filter out all topics that come from a subforum. I never managed to do that.

    I use this for the forumloop:

    `<?php if ( bb_forums() ) : ?>

    <?php while ( bb_forum() ) : global $forum; if ($forum->forum_parent != 0) continue; ?>`

    But I cant get something similar working with topics. And Im afraid that If i filter out this I will have trouble with the page counter too.

    Somehow the best solution would be a Default fallback Topic Icon. Anyone have any idea how I can solve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @finalwebsites

    Participant

    Hi,

    you mean like on my frontpage (check the link from my profile)

    I use this code:

    <?php while ( bb_forum() ) :
    if (get_forum_parent_id() == 0) : ?>
    <?php if (bb_get_forum_is_category()) : ?>
    <tr<?php bb_forum_class('bb-category'); ?>>
    <td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    </tr>
    <?php continue; endif; ?>
    <tr<?php bb_forum_class(); ?>>
    <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    <td class="num"><?php forum_topics(); ?></td>
    <td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php
    endif;
    endwhile; ?>

    The function get_forum_parent_id() is located in my personal plugin file:

    function get_forum_parent_id( $forum_id = 0 ) {
    $forum = get_forum( get_forum_id( $forum_id ) );
    return apply_filters( 'get_forum_parent_id', $forum->forum_parent, $forum->forum_id );
    }

    @anandasama

    Member

    I already know how to filter out subforums, but what I want (Weird request i know) is to filter out the posts who have a parent forum in the Latest Discussions.

    I also wonder if there is anyone who succeeded in making the topic icons plugin able to show a “default” icon for topics.

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