Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/24/2010 09:20:20 PM (15 years ago)
Author:
apeatling
Message:

bp-sn-parent tweaks and fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-templatetags.php

    r2413 r2431  
    196196            else if ( 'most-popular' == $order )
    197197                $type = 'popular';
    198             else if ( 'admin-of' == $order )
     198            else if ( 'admin-of' == $order ) {
    199199                $type = 'admin-of';
    200             else if ( 'mod-of' == $order )
     200                $user_id = $bp->displayed_user->id;
     201            } else if ( 'mod-of' == $order ) {
    201202                $type = 'mod-of';
    202             else if ( 'alphabetically' == $order )
     203                $user_id = $bp->displayed_user->id;
     204            } else if ( 'alphabetically' == $order )
    203205                $type = 'alphabetical';
    204206        } else if ( 'invites' == $bp->current_action ) {
     
    689691    }
    690692
     693function bp_group_forum_topic_count( $args = '' ) {
     694    echo bp_get_group_forum_topic_count( $args );
     695}
     696    function bp_get_group_forum_topic_count( $args = '' ) {
     697        global $groups_template;
     698
     699        $defaults = array(
     700            'showtext' => false
     701        );
     702
     703        $r = wp_parse_args( $args, $defaults );
     704        extract( $r, EXTR_SKIP );
     705
     706        if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) )
     707            return false;
     708
     709        if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
     710            return false;
     711
     712        if ( !$groups_template->group->forum_counts )
     713            $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     714
     715        if ( (bool) $showtext ) {
     716            if ( 1 == (int) $groups_template->group->forum_counts[0]->topics )
     717                $total_topics = sprintf( __( '%d topic', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
     718            else
     719                $total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
     720        } else {
     721            $total_topics = (int) $groups_template->group->forum_counts[0]->topics;
     722        }
     723
     724        return apply_filters( 'bp_get_group_forum_topic_count', $total_topics, (bool)$showtext );
     725    }
     726
     727function bp_group_forum_post_count( $args = '' ) {
     728    echo bp_get_group_forum_post_count( $args );
     729}
     730    function bp_get_group_forum_post_count( $args = '' ) {
     731        global $groups_template;
     732
     733        $defaults = array(
     734            'showtext' => false
     735        );
     736
     737        $r = wp_parse_args( $args, $defaults );
     738        extract( $r, EXTR_SKIP );
     739
     740        if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) )
     741            return false;
     742
     743        if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
     744            return false;
     745
     746        if ( !$groups_template->group->forum_counts )
     747            $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     748
     749        if ( (bool) $showtext ) {
     750            if ( 1 == (int) $groups_template->group->forum_counts[0]->posts )
     751                $total_posts = sprintf( __( '%d post', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
     752            else
     753                $total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
     754        } else {
     755            $total_posts = (int) $groups_template->group->forum_counts[0]->posts;
     756        }
     757
     758        return apply_filters( 'bp_get_group_forum_post_count', $total_posts, (bool)$showtext );
     759    }
     760
    691761function bp_group_is_forum_enabled( $group = false ) {
    692762    global $groups_template;
Note: See TracChangeset for help on using the changeset viewer.